Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Got error 'repetition-operator operand invalid' from regexp - mysql

Tags:

regex

php

mysql

When i try to use the following regexp in sql i am getting the error.

 [0-9]{10,}|(?:[\+\(]|1\-)\s*[0-9]+([ \.\(\)\-/x]+[0-9]{2,})+[0-9]

Please let me know the mistake i have done on this.

Error i am getting is,

1139 Got error 'repetition-operator operand invalid' from regexp

like image 886
Soumitra Avatar asked Oct 21 '22 15:10

Soumitra


1 Answers

See bug http://bugs.mysql.com/bug.php?id=399

\+ is getting seen as repetition-operator So this fails too:

mysql> select 'fred' regexp('?[\+]'); 
ERROR 1139 (42000): Got error 'repetition-operator operand invalid' from regexp
like image 106
PaulS Avatar answered Oct 27 '22 09:10

PaulS