You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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-].
Reacted by welljsjs, Ofek Ashery, Zer0Luck and boda
Reacted by welljsjs, Janne Raiskila, Alexander Akait and Ofek Ashery
It's a limitation of the current version of path-to-regexp we use. A work-around would be to use the following route: /:username([a-z][a-z-]{0,}) (i.e. use {0,} in place of *).
So is path-to-regexp not going to be updated until version 5.0? That's something I would really like to see as soon as possible. Also the website is misleading because it points to path-to-regexp and its regexp tester but it is currently very out of date.
It's not that we don't want to upgrade path-to-regexp before 5.0, but all versions above where we are at have breaking changes and thus must wait until 5.0. We cannot upgrade path-to-regexp is a 4.x minor release if people's existing 4.x routes break.
Activity
dougwilson commentedon Jan 12, 2015
It's a limitation of the current version of
path-to-regexpwe use. A work-around would be to use the following route:/:username([a-z][a-z-]{0,})(i.e. use{0,}in place of*).dougwilson commentedon Jan 12, 2015
I'm going to check if the most recent (non-backwards-compatible) version of
path-to-regexphandles this better.dougwilson commentedon Jan 12, 2015
It does. So this should be fixed in 5.0, but as for 4.x, you'll probably have to just use the old syntax :/
bevacqua commentedon Jan 12, 2015
dougwilson commentedon Jan 12, 2015
charlierudolph commentedon May 7, 2015
So is
path-to-regexpnot going to be updated until version 5.0? That's something I would really like to see as soon as possible. Also the website is misleading because it points to path-to-regexp and its regexp tester but it is currently very out of date.dougwilson commentedon May 7, 2015
It's not that we don't want to upgrade
path-to-regexpbefore 5.0, but all versions above where we are at have breaking changes and thus must wait until 5.0. We cannot upgradepath-to-regexpis a 4.x minor release if people's existing 4.x routes break.As for website issues, please file them at https://github.com/strongloop/expressjs.com
bevacqua commentedon May 7, 2015
For what it's worth, I've been using
{0,}without any inconvenients for a long while now.charlierudolph commentedon May 7, 2015
bevacqua commentedon May 7, 2015
12 remaining items
dougwilson commentedon Feb 1, 2017
Using {0,} should work the same with 5.x comes out while (*) will likely change meaning in 5, I believe.
ttencate commentedon May 15, 2017
dougwilson commentedon May 15, 2017
ttencate commentedon May 15, 2017
rjmunro commentedon Nov 22, 2017
VAggrippino commentedon Mar 23, 2018
rjmunro commentedon Mar 26, 2018
VAggrippino commentedon Mar 26, 2018
rjmunro commentedon Mar 28, 2018
mregydev commentedon Nov 8, 2018
This issue still exist in express 5.x in spite not being exist in Path-to-RegExp
app.get('/:number(\\d*\\d*)', (request, response) => { response.send(request.params.number) })It donot work with one digit parameter (http://localhost/2) but works with more than one digit parameters (http://localhost/22)
Thanks
dougwilson commentedon Feb 17, 2022
This is now resolved in 5.0.0-beta.1
VevoLiang commentedon Feb 17, 2022
fix: 🐛 express wildcard issue