Mega Code Archive

 
Categories / MySQL / Regular Expression
 

If you wish to encompass the entire character string, you must use ^ and $ in the search

mysql> mysql> mysql> SELECT 'abc' REGEXP '^abc$', 'abcabc' REGEXP '^abc$'; +----------------------+-------------------------+ | 'abc' REGEXP '^abc$' | 'abcabc' REGEXP '^abc$' | +----------------------+-------------------------+ |                    1 |                       0 | +----------------------+-------------------------+ 1 row in set (0.00 sec) mysql>