unstale

npm / path-to-regexp

path-to-regexp

What changed in path-to-regexp 1 to 9, from its official release notes, upgrade guides and advisories. Sources checked 2026-11-30.

36 breaking2 security9 new APIs and options6 performance5 behavior and defaults6 fixes and other

See which of these apply to your code, ranked, in your agent:

npx @unstale/cli init

@unstale/cli on npm

path-to-regexp 911 changes

Breaking changes 9

  • Compilation now rejects an empty-string parameter.

    9.0.0release notes

  • Compilation now rejects a wildcard array that produces an empty path.

    9.0.0release notes

  • The Keys type has been removed.

    9.0.0release notes

  • For ambiguous matches with two or more parameters in a segment, the last parameter is now greedy instead of the first.

    9.0.0release notes

  • The package now requires Node.js 22 or newer.

    9.0.0release notes

  • The package is now ESM only, so developers must use it as an ES module.

    9.0.0release notes

  • Stringification now quotes parameter names followed by astral ID_Continue text.

    9.0.0release notes

  • The TokenData class has been removed.

    9.0.0release notes

  • A path that explicitly provides its trailing delimiter, such as /foo/, no longer appends an extra optional delimiter.

    9.0.0release notes

Fixes and other changes 2

  • Stringifying parameter names with control characters is fixed.

    9.0.0release notes

  • Stringification lookahead across empty text tokens is fixed.

    9.0.0release notes

path-to-regexp 818 changes

Breaking changes 4

  • Limits generated combinations for optional route groups to fewer than 256, rejecting large combinations to avoid regex size explosions.

    8.4.0release notes

  • The ?, +, and * group suffixes are removed; use wildcards for + and {*foo} for *.

    8.0.0release notes

  • The loose mode is removed.

    8.0.0release notes

  • Regular expression overrides of parameters are removed.

    8.0.0release notes

Security 2

  • path-to-regexp vulnerable to Denial of Service via sequential optional groups

    8.4.0security advisory

  • Restricts wildcard backtracking when a path uses more than one wildcard, addressing the listed security vulnerabilities.

    8.4.0release notessecurity advisory

New APIs and options 3

  • Match accepts an array of string or TokenData values in addition to a single string or TokenData.

    8.0.0release notes

  • Wildcards can have key names using *name syntax, aligning with : behavior.

    8.0.0release notes

  • Parameter names can be quoted, allowing names such as foo-bar.

    8.0.0release notes

Performance 5

  • Minimizes array allocations.

    8.4.2release notes

  • Reduces bundle size from 1.97 kB to 1.93 kB.

    8.4.2release notes

  • Improves compile performance by about 25%.

    8.4.2release notes

  • Removes internal tokenization during parse, which should improve parse performance by about 20%.

    8.4.2release notes

  • Deduplicates regex prefixes, resulting in shorter regular expressions for some cases using optional groups.

    8.4.0release notes

Behavior and default changes 1

  • Parameter names follow JavaScript identifier rules and allow Unicode characters.

    8.0.0release notes

Fixes and other changes 3

  • Fixes an error caused by a trailing backslash.

    8.4.2release notes

  • Backtrack handling now allows a parameter to match itself, including matching the second underscore in /foo__.

    8.4.1release notes

  • Wildcards in non-ending mode no longer stop at the first match, avoiding truncated matches.

    8.4.1release notes

path-to-regexp 721 changes

Breaking changes 15

  • Arrays and regular expressions are no longer supported as inputs.

    7.0.0release notes

  • The ESM and CommonJS dual package is removed in favor of a single supported CommonJS export.

    7.0.0release notes

  • The function returned by compile accepts only string values; repeated values must be arrays of strings when encode is not false.

    7.0.0release notes

  • decode now defaults to decodeURIComponent.

    7.0.0release notes

  • encode and decode no longer receive the token as their second parameter.

    7.0.0release notes

  • encode now defaults to encodeURIComponent.

    7.0.0release notes

  • The endsWith option has been removed.

    7.0.0release notes

  • The minimum JavaScript support level is ES2020, raised from ES2015.

    7.0.0release notes

  • Loose matching is enabled by default, allowing repeated / characters in matched paths; loose can also be set as an option to match delimiters arbitrarily.

    7.0.0release notes

  • Modifiers ?, *, and + must follow a parameter explicitly wrapped in {}; / and . are no longer implied prefixes.

    7.0.0release notes

  • regexpToFunction has been removed as exports are simplified.

    7.0.0release notes

  • Semicolon, comma, exclamation mark, and at sign are reserved for future use cases.

    7.0.0release notes

  • tokensToFunction has been removed as exports are simplified.

    7.0.0release notes

  • tokensToRegexp has been removed as exports are simplified.

    7.0.0release notes

  • The former strict: true setting is renamed to trailing: false.

    7.0.0release notes

New APIs and options 4

  • decode can be set to false to skip all processing of parameter input and output.

    7.0.0release notes

  • encode can be set to false to skip all processing of parameter input and output.

    7.0.0release notes

  • Adds encodePath to handle the difference between encoding paths and parameters.

    7.0.0release notes

  • All remaining methods accept TokenData, exported and returned by parse, as input, allowing programmatically built paths or avoiding repeated parsing.

    7.0.0release notes

Behavior and default changes 1

  • Parameter names can contain all Unicode identifier characters defined by \p{XID_Continue}.

    7.0.0release notes

Fixes and other changes 1

  • The standalone wildcard is available again and matches Express.js expected behavior.

    7.0.0release notes

path-to-regexp 64 changes

Breaking changes 2

  • The prefixes option configures which characters can act as prefixes; it starts as /., reverting the prefix behavior added in v3.

    6.0.0release notes

  • Tokens in unexpected positions now throw an error; an unclosed ( is treated as a group and can be escaped to remain literal.

    6.0.0release notes

New APIs and options 1

  • Braces capture prefix and suffix explicitly, enabling custom use cases such as /:attr1{-:attr2}?.

    6.0.0release notes

Behavior and default changes 1

  • Regular expressions now support nested non-capturing groups.

    6.0.0release notes

path-to-regexp 53 changes

Breaking changes 3

  • Encoding now uses the identity function by default instead of encodeURIComponent.

    5.0.0release notes

  • normalizePathname was removed from the library; the README documents a solution.

    5.0.0release notes

  • The RegexpOptions interface was renamed to TokensToRegexpOptions.

    5.0.0release notes

path-to-regexp 46 changes

Breaking changes 3

  • Export names changed to support ES2015 modules in bundlers.

    4.0.0release notes

  • match no longer defaults to decodeURIComponent.

    4.0.0release notes

  • Path rules remain backward compatible with 3.x except nested () and other RegEx special characters that were previously ignored.

    4.0.0release notes

New APIs and options 1

  • A new utility supports unicode paths in libraries.

    4.0.0release notes

Performance 1

  • ES2015 modules enable tree-shaking for webpack and other bundlers.

    4.0.0release notes

Behavior and default changes 1

  • Nested non-capturing groups are supported within parameters.

    4.0.0release notes

path-to-regexp 11 changes

Behavior and default changes 1

  • The release states there will be no more API changes.

    1.0.0release notes