Liquid Web Managed Word Press

8 basics of regular expression that can make you expert

Well, regular expressions have been something that I was scared of when I started coding as a serious stuff. The string literals puzzled me like anything. preg_match, preg_grep, preg_split, preg_replace etc have been something I always wanted to avoid. But thanks to phpbuilder and php that I can now handle them with some ease. And this is for you guys who find regular expressions tacky.



1. “^tech“

Searches a string that starts with tech.

2. “logy$”

Searches for strings that ends up in logy.

3. “a*b”

Looks for a string that has either zero or more a’s but exactly one b following a. (eg. b, ab, aab, aaab, aaaaaaaaaaaaaaaaab etc.).

4. “a+b”

Same as a*b but only difference is that atleast one a should be there in the string unlike a*b which can overlook a. (eg. ab, aab,aaaaaaaaab etc).

5. “a?b”

In this case string might have either zero or a single a (eg. ab or b) only these two possibilities are there.



To quantify the characters into certain sets and utilize them we can use paranthesis().

6. “(abc)+def”

Matches a string which consists of pattern having abc either one or n times followed by def at the end.



7. “(a|b)*c”

A string of a and b that ends in a c.
To specify range of characters. For instance to match that in a password small-case character, you can specify the set as [a-z] or [A-Z] or [0-9].

8. “([a-z])|([A-Z])”

Searches for a pattern having either small-case or capital letters.


That’s all

Recently Published


Java Programming Language And Its Application

Programming language is one of the main IT developments of the past ...


Why Can’t I Add or Install Plugins in WordPress

WordPress is a great choice when it comes to Content Management ...


5 Website Security Myths You Should Know About

Businesses today are getting increasingly dependent on their ...


Capturing HD Videos with Movavi Screen Capture Studio

As you probably know High Definition (HD) videos are regarded as the ...


Modern Changes That You Should Consider for Your Web Site

Websites need to modernize and get updated periodically otherwise ...


Super Tips For A Flawless Website

A website has a specific purpose. And your job is to design a website ...


Wix Offers Best Free Web Apps for Artists and Photographers

The famous online website builder Wix is known for providing the ...


What You Should Know Before Setting Up a Digital Marketing and Web Design Company

Running a digital marketing and web designing company can be a ...


Important Factors to Think About When Starting a Mailing List

Many bloggers and business owners don’t have a mailing list, ...