Skip to content

fix issues with complex multi-param#349

Merged
dimdenGD merged 1 commit into
dimdenGD:mainfrom
CL-Jeremy:fix-multi-param-issues
Jul 16, 2026
Merged

fix issues with complex multi-param#349
dimdenGD merged 1 commit into
dimdenGD:mainfrom
CL-Jeremy:fix-multi-param-issues

Conversation

@CL-Jeremy

Copy link
Copy Markdown
Contributor

This PR fixes multiple issues with the current matching strategy with regards to multi-param routes:

  • Regex in named capture groups is treated as patterns, breaking for - and . as they are not meant verbatim there
  • Regex handling is incompatible with multi-param (resulting in an extra slash)
  • Regex in named capture groups processed twice (first as pattern) resulting in both indexed and named params, breaking exact match with Express
  • Paths with named params without regex are still complex (implicit ([^/]+)), but are wrongly optimized (happening in app but not router, which confused me a lot initially)

The ideas come from my personal use case and the official Express.js 4.x documentation, with the official path-to-regexp 0.1.x as a loose reference.

Not sure if the test cases are okay like this (may need to reorganize), but they definitely serve the purpose of identifying the exact problems with the current implementation.

@CL-Jeremy

Copy link
Copy Markdown
Contributor Author

Well, test on Node.js 26 still depends on #348.

@dimdenGD
dimdenGD merged commit de8963e into dimdenGD:main Jul 16, 2026
3 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants