Skip to content

docs: clarify req.params type and usage with regular expressions#2101

Merged
bjohansebas merged 1 commit intoexpressjs:gh-pagesfrom
krzysdz:req.params-object
Dec 14, 2025
Merged

docs: clarify req.params type and usage with regular expressions#2101
bjohansebas merged 1 commit intoexpressjs:gh-pagesfrom
krzysdz:req.params-object

Conversation

@krzysdz
Copy link
Copy Markdown
Contributor

@krzysdz krzysdz commented Nov 1, 2025

Fixes #2100

@krzysdz krzysdz requested a review from a team as a code owner November 1, 2025 23:24
@netlify
Copy link
Copy Markdown

netlify Bot commented Nov 1, 2025

Deploy Preview for expressjscom-preview ready!

Name Link
🔨 Latest commit 6c91e0c
🔍 Latest deploy log https://app.netlify.com/projects/expressjscom-preview/deploys/6913bd134ed14f00080d127a
😎 Deploy Preview https://deploy-preview-2101--expressjscom-preview.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Nov 1, 2025

🚦 Lighthouse Results (Mobile & Desktop)

URL Device Perf A11y Best Practices
/ mobile 🔴 58 🟢 100 🟢 96
/en/blog/posts.html mobile 🟢 98 🟢 96 🟢 96
/en/5x/api.html mobile 🟠 76 🟢 95 🟢 96
/ desktop 🟢 100 🟢 100 🟢 96
/en/blog/posts.html desktop 🟢 100 🟢 96 🟢 92
/en/5x/api.html desktop 🟢 97 🟢 95 🟢 96

Copy link
Copy Markdown
Member

@bjohansebas bjohansebas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@bjohansebas bjohansebas merged commit 0cfa8d0 into expressjs:gh-pages Dec 14, 2025
20 checks passed
@bjohansebas bjohansebas added docs Issues/pr concerning content 5.x Docs for 5.x version 4.x Docs for 4.x version labels Dec 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

4.x Docs for 4.x version 5.x Docs for 5.x version docs Issues/pr concerning content

Projects

None yet

Development

Successfully merging this pull request may close these issues.

req.params docs claim that this property can be an array

3 participants