MySQL Programming Question:
How To Use Regular Expression in Pattern Match Conditions?
Answer:
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 'GlobalGuideLine.com' REGEXP '.*ggl.*' FROM DUAL;
1
SELECT 'GlobalGuideLine.com' REGEXP '.*com$' FROM DUAL;
1
SELECT 'GlobalGuideLine.com' REGEXP '^F.*' FROM DUAL;
1
SELECT 'GlobalGuideLine.com' REGEXP '.*ggl.*' FROM DUAL;
1
SELECT 'GlobalGuideLine.com' REGEXP '.*com$' FROM DUAL;
1
SELECT 'GlobalGuideLine.com' REGEXP '^F.*' FROM DUAL;
1
Previous Question | Next Question |
How To Use LIKE Conditions? | How To Use CASE Expression? |