Mega Code Archive

 
Categories / MySQL Tutorial / Regular Expressions
 

Match the beginning and end of words, respectively( [[

mysql> mysql> SELECT 'a word a' REGEXP '[[:<:]]word[[:>:]]'; +----------------------------------------+ | 'a word a' REGEXP '[[:<:]]word[[:>:]]' | +----------------------------------------+ |                                      1 | +----------------------------------------+ 1 row in set (0.00 sec) mysql> mysql> SELECT 'a xword a' REGEXP '[[:<:]]word[[:>:]]'; +-----------------------------------------+ | 'a xword a' REGEXP '[[:<:]]word[[:>:]]' | +-----------------------------------------+ |                                       0 | +-----------------------------------------+ 1 row in set (0.00 sec) mysql>