我想匹配('开头的字符,或')'字符串末尾的字符。我尝试过theese(字符串的开头),但没有任何作用:
mysql> SELECT '(aaa' REGEXP '[[:<:]]\\(aaa';
+-------------------------------+
| '(aaa' REGEXP '[[:<:]]\\(aaa' |
+-------------------------------+
| 0 |
+-------------------------------+
1 row in set (0.00 sec)
mysql> SELECT '(aaa' REGEXP '[[:<:]][(]aaa';
+-------------------------------+
| '(aaa' REGEXP '[[:<:]][(]aaa' |
+-------------------------------+
| 0 |
+-------------------------------+
1 row in set (0.00 sec)
答案 0 :(得分:0)
我认为你不需要在这里使用正则表达式,因为LIKE
运算符应该足够了:
SELECT *
FROM yourTable
WHERE col LIKE '(%' OR col LIKE '%)'