-
Notifications
You must be signed in to change notification settings - Fork 22
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
Matching (
and )
in a regexp matcher requires escaping
#177
Comments
Actually I think we need to fix this for sure. Consider these two patterns: // valid regexp, but pattern tokenizer thinks there is a nested group that isn't closed
const pattern = new URLPattern({ pathname: '/([(?])' });
// valid regexp group, valid urlpattern, except that this throws because "Invalid regular expression: /^(?:/([))\]\)$/u: Unterminated character class"
const pattern = new URLPattern({ pathname: '/([)])' }); |
Yea, seems like a real problem to me. I'm not sure when I will have the bandwidth to look at this, though. Do you have a proposed fix? |
I think we have to keep track of |
Is this true? Given #178 we'll support syntax like |
Fails, even though it's valid:
OK:
This is because while tokenizing the pattern, we think the second
(
is a nested group rather than just a char in a regexp character class.Fixing this will make the tokenizer more complicated. Is it worth it?
The text was updated successfully, but these errors were encountered: