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的確如此。 –