Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
tunetheweb opened this issue Aug 23, 2024 · 0 comments · Fixed by #232
Closed

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

tunetheweb opened this issue Aug 23, 2024 · 0 comments · Fixed by #232

Comments

@tunetheweb
Copy link

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?

jeremyroman added a commit that referenced this issue Aug 29, 2024
These examples form the only quick reference material in the spec. While MDN goes into more depth, brief explanations of what is happening in this syntax don't take up much room and may make it easier to tell what's going on, especially with regexp parts.

The example explaining pattern strings is also expanded to be explicit that regular expressions are enclosed in parentheses.

Resolves #229.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging a pull request may close this issue.

1 participant