Validate Regular Expression Syntax in PHP? - TechRepublic
General discussion
November 28, 2010 at 12:01 PM
simple.fatima

Validate Regular Expression Syntax in PHP?

by simple.fatima . Updated 15 years, 7 months ago

Is there any way to check and validate regular expression syntax before processing it in php.
I’ve a scenario in which user input regular expression and my piece of code process user input regular expression, but validation is necessary before processing it and message if invalid regular expression syntax.
such as, ‘/[abc]/’
User inputs, ‘/[abc/’
the code prompt an error because closing ‘]’ is missing!
Kindly suggest solution!

This discussion is locked

All Comments