0
我试图用这个正则表达式的字符串来查询我的MySQL数据库,MySQL的正则表达式 - 如何寻找一个特定的顺序组词
^(?=.*?\\bAuto\\b)(?=.*?\\bAnd\\b)(?=.*?\\bFashion\\b)(?=.*?\\bFair\\b).*$
在我的本地
它完美,但在远程服务器我得到的误差如下:
[03-Mar-2017 09:49:47 UTC] PHP Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[42000]: Syntax error or access violation: 1139 Got error 'repetition-operator operand invalid' from regexp' in /home/public_html/assets/sys/pdo.php:491
FYI,生成的查询字符串如下:
$SELECT * FROM table WHERE name REGEXP "^(?=.*?\\bAuto\\b)(?=.*?\\bAnd\\b)(?=.*?\\bFashion\\b)(?=.*?\\bFair\\b).*$" AND status = 1
分割成几个'WHERE名称REGEXP“[[::<:]]Auto[[:>:]]”AND WHERE name REGEXP“[[::<:]]And[[:>:]]”AND WHERE name REGEXP“[[:<:]] Fashion [[: ]]“以及名称REGEXP”[[:<:]]Fair[[:>:]]“'。 MySQL正则表达式不支持'\ b',并且也不支持周边查询。 –
MySQL的'REGEXP'不处理'(?'; MariaDB的确如此。 –