Releases: pillarjs/path-to-regexp
Releases · pillarjs/path-to-regexp
Updated README
No API changes. Documentation only release.
Changed
Support named matching groups in `RegExp`
Fix matching `:name*` parameter
Named Capturing Groups
Use `/#?` as Default Delimiter
Fixed
- Use
/#?
as default delimiter to avoid matching on query or fragment parameters- If you are matching non-paths (e.g. hostnames), you can adjust
delimiter: '.'
- If you are matching non-paths (e.g. hostnames), you can adjust
Custom Prefix and Suffix Groups
Note: The path syntax has been stabilized with this release, no breaking changes in paths is expected.
This release reverts the prefix behavior added in v3 back to the behavior seen in v2. For the most part, path matching is backward compatible with v2 with these enhancements:
- Support for nested non-capturing groups in regexp, e.g.
/(abc(?=d))
- Support for custom prefix and suffix groups using
/{abc(.*)def}
- Tokens in an unexpected position will throw an error
- Paths like
/test(foo
previously worked treating(
as a literal character, now it expects(
to be closed and is treated as a group - You can escape the character for the previous behavior, e.g.
/test\(foo
- Paths like
Changed
- Revert using any character as prefix, support
prefixes
option to configure this (starts as/.
which acts like every version since 0.x again) - Add support for
{}
to capture prefix/suffix explicitly, enables custom use-cases like/:attr1{-:attr2}?
Remove Default Encode URI Component
No changes to path rules since 3.x, except support for nested RegEx parts in 4.x.
Changed
- Rename
RegexpOptions
interface toTokensToRegexpOptions
- Remove
normalizePathname
from library, document solution in README - Encode using identity function as default, not
encodeURIComponent
Decode URI
Removed
- Remove
whitelist
in favor ofdecodeURI
(advanced behavior can happen outsidepath-to-regexp
)
Remove `String#normalize`
Fixed
- Remove usage of
String.prototype.normalize
to continue supporting IE
Normalize Path Whitelist
Added
- Add normalize whitelist of characters (defaults to
/%.-
)