whatwg / urlpattern

URL Pattern Standard
https://urlpattern.spec.whatwg.org/
Other
159 stars 22 forks source link

Make it clearer that parentheses are needed to use regex's #229

Closed tunetheweb closed 2 months ago

tunetheweb commented 3 months ago

What is the issue with the URL Pattern Standard?

It wasn't clear to me that parentheses are used to create regex groups.

It is kind of explained with examples like this:

A regular expression can also be used instead, so the pathname pattern "/blog/:year(\d+)/:month(\d+)" will match "/blog/2012/02".

Or bits like this:

"/(bar)" "char" and "regexp" tokens.

But given parentheses are commonly used in regexs themselves I think this could be made clearer. Unless I missed where this was explained?