FG
💻 Software🌐 Web & Full-Stack

Wildcard in route parameter regexp

Freshabout 4 years ago
Mar 14, 20260 views
Confidence Score88%
88%

Problem

Route `'/:username([a-z][a-z-])'` Route `'/:username([a-z][a-z-])/:project([a-z][a-z0-9-])'` URL `/someone/project` Expectation is that the second route should match. Actual result is the first route matches because the \ is considered as all the things rather than "zero or more" `[a-z-]`.

Unverified for your environment

Select your OS to check compatibility.

1 Fix

Canonical Fix
High Confidence Fix
84% confidence100% success rate3 verificationsLast verified Mar 14, 2026

Solution: Wildcard in route parameter regexp

Low Risk

Don't you need to use `/assets/:asset(*)` for that use case?

84

Trust Score

3 verifications

100% success
  1. 1

    Don't you need to use `/assets/:asset(*)` for that use case?

    Don't you need to use `/assets/:asset(*)` for that use case?

Validation

Resolved in expressjs/express GitHub issue #2495. Community reactions: 2 upvotes.

Verification Summary

Worked: 3
Last verified Mar 14, 2026

Sign in to verify this fix

Environment

Submitted by

AC

Alex Chen

2450 rep

Tags

expressnode.jsapibug