I have a php5 app which performs mysql searches, and I give the user the possibility to enter a regular expression to use with RLIKE.

I want to be sure that the regular expression is valid, in order not to get any error when the query is executed, and I searched the web for a regex to use in php, which validates the mysql regex. I couldn't find anything.

I'm able to build a regex, but my hope is that someone already did this work. Any help to find it?

  • no, I don't want you to do the effort for me. I thought that maybe someone knows how to find it in the web – Paolo Benvenuto Nov 11 '15 at 10:51

Actually it seems that's not possible to describe a regular expression with a regular expression, because the definition should include recursive elements like the various levels of nesting of parenthesis.

This seems to be confirmed by the fact that regular expression are scanned at software level, and the scanner/compiler is who reports an error.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.