Using Regular Expression with REGEXP in MySQL

Q

How To Use Regular Expression in Pattern Match Conditions in MySQL?

✍: FYIcenter.com

A

If you have a pattern that is too complex for LIKE to handle, you can use the regular expression pattern condition: REGEXP. The following tutorial exercise provides you some good examples:

SELECT 'FYICenter.com' REGEXP '.*fyi.*' FROM DUAL;
   1

SELECT 'FYICenter.com' REGEXP '.*com$' FROM DUAL;
   1

SELECT 'FYICenter.com' REGEXP '^F.*' FROM DUAL; 
   1

 

Introduction to SQL Basics in MySQL

⇒⇒MySQL Database Tutorials

2016-10-17, 201👍, 0💬