Live data from Hacker News

Is there a regular expression to detect a valid regular expression?

stackoverflow.com

1–10 of 224 posts

Re: Is there a regular expression to detect a valid regular expression?

#7
The answer is as horrifying as you'd expect, but impressive nonetheless. Recursive regex is really fun and powerful, when it works.

I once made a recursive regex for matching a full name, complete with checking for suffixes, prefixes, an undefined amount of middle names, hyphenated last names, and Scotch-Irish names (Mc-, O'-, etc). Still simpler than this monstrosity.

Re: Is there a regular expression to detect a valid regular expression?

#10
post #5
post #3

Why would you want a regular expression to detect a valid regular expression?

Probably to check if a regular expression is valid

Yes, checking to see if a regular expression is valid is useful but that wasn't what I was asking. Why specifically would you want to use a regular expression for this job?
Post reply on HN