MySQL Tutorial/Regular Expressions/word

Материал из SQL эксперт
Перейти к: навигация, поиск

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>
mysql>