Live data from Hacker News

Is there a regular expression to detect a valid regular expression? (2008)

stackoverflow.com

1–10 of 13 posts

Re: Is there a regular expression to detect a valid regular expression? (2008)

#3
Other than the appealing symmetry of being able to use a language to parse that same language, this feels very similar to https://stackoverflow.com/questions/1732348/regex-match-open...

Edit: I just checked and sadly someone beat me to it in 2019: https://news.ycombinator.com/item?id=20910120

Re: Is there a regular expression to detect a valid regular expression? (2008)

#4
Damian Conway's https://metacpan.org/pod/PPR module defines a regex (in the commonly used sense) that can match perl source code - including perl regexes!

Edit: "The PPR module provides a single regular expression that defines a set of independent subpatterns suitable for matching entire Perl documents, as well as a wide range of individual syntactic components of Perl (i.e. statements, expressions, control blocks, variables, etc.)"

Re: Is there a regular expression to detect a valid regular expression? (2008)

#9
post #5

I answered a funny regex question once, “can strings that are base64 encoded twice be matched with a regex?” https://stackoverflow.com/questions/49650847/determine-if-st... The answer is yes, they’re regular. :-D

That's amazing. Thank you!
Post reply on HN