Regexp that matches valid regexps

前端 未结 7 1174
北荒
北荒 2020-12-03 02:38

Is there a regular expression that matches valid regular expressions?

(I know there are several flavors of regexps. One would do.)

7条回答
  •  暖寄归人
    2020-12-03 03:08

    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.

提交回复
热议问题