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
Not internally consistent with the full wilcard in handling newline ;
Relying on an obscure regex feature: inverted empty character class or empty character class complement.
Tricky for some current implementation of RegExp v flag.
The proposed change should make the segment wildcard more consistent with the full wildcard and, in passing, be more forgiving for buggy RegExp implementation.
When processing regex pattern for most part of an URL (expect for host and path), the generate a segment wildcard regexp method will be called with the default options for which the delimiter code point in the empty string.
The generated regex string is then [^]+?, an inverted empty character class with lazy matching. It matches every character, including newline, which is slightly different from the full wildcard (matches every character excluding newline).
What is the issue with the URL Pattern Standard?
The generate a segment wildcard regexp steps generate a regex that is :
v
flag.The proposed change should make the segment wildcard more consistent with the full wildcard and, in passing, be more forgiving for buggy RegExp implementation.
When processing regex pattern for most part of an URL (expect for host and path), the generate a segment wildcard regexp method will be called with the default options for which the delimiter code point in the empty string.
The generated regex string is then
[^]+?
, an inverted empty character class with lazy matching. It matches every character, including newline, which is slightly different from the full wildcard (matches every character excluding newline).But combined with the
v
flag required by the specs it works differently: the regex try to match a complement class instead of inverting the match. This should be equivalent when dealing with an empty class but it seems some current implementations don't handle this very well. Testing the generated regex/^([^]+?)$/v.test("foobar")
with current RegExp implementations:This simple change would avoid dealing with the empty character class regex in the first place and avoid the newline inconsistency.
In generate a segment wildcard regexp
by
It ensures the character class is never empty.
The text was updated successfully, but these errors were encountered: