docs: clarify req.params type and usage with regular expressions#2101
docs: clarify req.params type and usage with regular expressions#2101bjohansebas merged 1 commit intoexpressjs:gh-pagesfrom
Conversation
✅ Deploy Preview for expressjscom-preview ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
🚦 Lighthouse Results (Mobile & Desktop)
|
18b7bdd to
6c91e0c
Compare
There was a problem hiding this comment.
Good catch, for referencese expressjs/express#1835 is where the change was made for express v4/v5
ref https://github.com/pillarjs/router/blob/cb2a5fcdf31b9cc92296183ceeff8126b5c57453/index.js#L68
There was a problem hiding this comment.
Pull request overview
This PR clarifies the documentation for req.params to better explain how it handles regular expression route patterns. The changes improve technical accuracy by correcting a misleading description and add helpful information about named capturing groups.
- Corrects the description of how capture groups are stored (as integer keys in an object, not in an array)
- Adds documentation for named capturing groups in regular expressions
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| _includes/api/en/5x/req-params.md | Updates Express 5.x documentation to clarify that regex capture groups use integer keys and adds info about named capturing groups |
| _includes/api/en/4x/req-params.md | Updates Express 4.x documentation with the same clarifications for consistency |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Fixes #2100