urlpattern
urlpattern copied to clipboard
Matching `(` and `)` in a regexp matcher requires escaping
Fails, even though it's valid:
const pattern = new URLPattern({ pathname: '/([()])' });
Uncaught TypeError: tokenizer error: invalid regex: nested groups must start with ? (at char 1)
OK:
const pattern = new URLPattern({ pathname: '/([\\(\\)])' });
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?