whatwg/urlpattern

Use `v` regexp flag instead of `u`

nicolo-ribaudo opened this issue · 1 comments

The v flags add more support to regular expression features:

The HTML <input>'s pattern attribute has also been recently updated to use v instead of u (https://html.spec.whatwg.org/#compiled-pattern-regular-expression).

bathos commented

The “set operations” would be useful. I‘m pretty sure the second never will be, though, because ...

 new URLPattern({ pathname: "/🍒" }).test("https://bar.com/🍒"); true new URLPattern({ pathname: "/(\p{Emoji})" }).test("https://bar.com/🍒"); false new URLPattern({ pathname: "/(\p{Ll})" }).test("https://bar.com/a"); true new URLPattern({ pathname: "/(\p{Ll})" }).test("https://bar.com/é"); false new URLPattern({ pathname: "/%F0%9F%8D%92" }).test("https://bar.com/🍒"); true

— the illusion that non-ASCII is matchable is limited to literal input: it converts non-ASCII input to percent encoded UTF-8, but regexp pattern components aren’t likewise “translated”, so expressing things like \p{RGI_Emoji_Sequence} seems to always require input that’s similar to what transpilers might produce today for engines that don’t support multi- or single- codepoint properties at all.