Regexp that matches valid regexps

前端 未结 7 1184
北荒
北荒 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:05

    Depending on your goal I would say definately maybe.

    If you want to filter regexps out from somewhere, it might prove difficult as regular expressions come in all sizes and shapes and they don't all start and end with slashes.

    If you just need to know wether or not a regexp is valid there is another way. Depending on the language you're using you could try/catch

    If you can be more specific I could try and give a better answer, the question is intruiging.

提交回复
热议问题