MySQL: Search String using Regular Expressions (REGEXP)

A regular expression is a special text or string which is describing a different search pattern.

Generally, when we are validating email addresses, IP-Addresses and any other special string, we should use regular expression for perfect pattern matching.

Using regular expressions, you can check different special character, numbers, lower and capital letters.

MySQL provides REGEXP for performing pattern matching in WHERE clause.
Some of the few examples are here:

First, create a table with sample data:

Check for numbers:

Check for lower and upper letters:

Check for all symbols:

Check for all the combinations:

Please share your ideas and opinions about this topic with me, your contribution will add true value to this topic.
If anyone has doubts on this topic then please do let me know by leaving comments or send me an email.

If you like this post, then please share it with others.
Please follow, I will share my experience towards the success of Database Research and Development Activity.

I put up a post every day, please keep reading and learning.
Discover Yourself, Happy Blogging !
Anvesh M. Patel.

More from

Leave a Reply

Be the First to Comment!

Notify of