You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Matching ( and ) in a regexp matcher requires escaping #177
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 closedconstpattern=newURLPattern({pathname: '/([(?])'});// valid regexp group, valid urlpattern, except that this throws because "Invalid regular expression: /^(?:/([))\]\)$/u: Unterminated character class" constpattern=newURLPattern({pathname: '/([)])'});
I think we have to keep track of [ and ] in the tokenizer while parsing regexp tokens, and ignore all ( and ) while between a [ and ] in that regexp. This can be a simple boolean as character classes can't be nested (no need to keep track of depth).
Activity
lucacasonato commentedon Jul 10, 2023
Actually I think we need to fix this for sure. Consider these two patterns:
wanderview commentedon Jul 10, 2023
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?
lucacasonato commentedon Jul 10, 2023
I think we have to keep track of
[and]in the tokenizer while parsing regexp tokens, and ignore all(and)while between a[and]in that regexp. This can be a simple boolean as character classes can't be nested (no need to keep track of depth).jeremyroman commentedon Sep 13, 2023
Is this true? Given #178 we'll support syntax like
[\d--[07]](every digit except 0 and 7) as part of the UnicodeSets regexp mode.