-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Slashes in character classes in RegExp literals #584
Comments
Escape the inner |
It's allowed because you don't need to escape things in square braces. |
I'm with weepy, the examples given by satyr should be valid. This looks like a bug to me. |
Anyone got neat ideas for how to parse this in the lexer, without resorting to a fullblown regex parser? |
You mean you don't want to have to write a regex-matching regex for the lexer? Sounds fun to me, but could potentially be extremely complicated. Anyway, I don't see how it could be avoided. |
Given how messy to tokenize regexps already are, shouldn't you consider an alternative, cleaner regexp syntax? Something that shares most if its lexing code with string literals? |
I just wrote the following regular expression to match regular expressions:
Anyone have a valid regex that can break it or an invalid regex that it matches? edit: Crap, I completely forgot about the regex interpolation... that makes this a much more difficult problem. |
Regular expresion strings are not actually regular. They, for instance, include the language of matching parenthesis, which require stack automaton. Pumping lemma suffices to easily show this. On the other hand, their grammar is quite simple. This so question shows it. |
I've merged satyr's "heregex" branch to master, which fixes this issue, (as well as adding heregexes) ... closing the ticket. |
Found some quirks with them:
The text was updated successfully, but these errors were encountered: