Is there a regular expression to detect a valid regular expression?
stackoverflow.com
Is there a regular expression to detect a valid regular expression?
1–10 of 224 posts
Re: Is there a regular expression to detect a valid regular expression?
#2I believe Zalgo has the answer to this, via an equivalent question. https://stackoverflow.com/questions/1732348/regex-match-open...
Re: Is there a regular expression to detect a valid regular expression?
#3Why would you want a regular expression to detect a valid regular expression?
Re: Is there a regular expression to detect a valid regular expression?
#4IIRC, regex can be implemented by an NFA which can't solve balanced parentheses that are part of regex syntax.
Re: Is there a regular expression to detect a valid regular expression?
#5Why would you want a regular expression to detect a valid regular expression?
Probably to check if a regular expression is valid
Re: Is there a regular expression to detect a valid regular expression?
#6Re: Is there a regular expression to detect a valid regular expression?
#7The 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?
#8IIRC, regex can be implemented by an NFA which can't solve balanced parentheses that are part of regex syntax.
Re: Is there a regular expression to detect a valid regular expression?
#9I did enjoy the comment with the Xhibit/Pimp my Ride reference.
Re: Is there a regular expression to detect a valid regular expression?
#10Why 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?