-
-
Notifications
You must be signed in to change notification settings - Fork 392
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
"path must be" (regex) syntax in v8 (i18n/localization) #349
Comments
I decided to adopt URLPattern now that it has become the standard for the web. |
Sounds good. URLPattern is based off the v6 syntax of this library anyway so it should be a smooth transition for you. In v8 there currently isn't regex support due to time constraints, but it would actually be fairly simple to add what you're asking for specifically (i.e. a limited subset of regex support). I'll leave this closed since you've resolved your issue, but it is on my backlog to add regex support back so you can write |
Hi there,
I am wondering how path-to-regexp would support matching paths "only if" or whether I need to adopt URLPattern.
Use case i18n
I need a pattern that matches localized URLs.
The pattern I came up with
"http{s}\\://:domain/{:locale}{/*path}"
(correctly) matches anything as:locale
. Hence,https://example.com/page
is matched asparameters: { locale: page }
, which is incorrect. The desired locale parameter should be undefined.In old path-to-regexp <8 and URLPattern, regex helps establish the desired behavior (try it out yourself).
The text was updated successfully, but these errors were encountered: