Regexp that matches valid regexps

Is there a regular expression that matches valid regular expressions?

By definion, it’s quite simple: No.

The language of all regexes is no regular language (just look at nested parentheses) and therefore there can’t be a regular expression to parse it.

Leave a Comment