Is it possible to have regexp that matches all valid regular expressions?

Posted by Juha Syrjälä on Stack Overflow See other posts from Stack Overflow or by Juha Syrjälä
Published on 2010-05-25T17:19:22Z Indexed on 2010/05/25 17:21 UTC
Read the original article Hit count: 292

Is it possible to detect if a given string is valid regular expression, using just regular expressions?

Say I have some strings, that may or may not be a valid regular expressions. I'd like to have a regular expression matches those string that correspond to valid regular expression. Is that possible? Or do I have use some higher level grammar (i.e. context free language) to detect this? Does it affect if I am using some extended version of regexps like Perl regexps?

If that is possible, what the regexp matching regexp is?

© Stack Overflow or respective owner

Related posts about computer-science

Related posts about regular-language