Discussion Locked

Validate Regular Expression Syntax in PHP?

0 helpful
1 reply
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

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!

1 reply

This discussion is closed to new replies.