Skip to content

named groups in regex routers not supported? #4277

Description

@its-dibo
// /regex/hello -> matches
app.get(/\/regex\/(.+)/, (req, res) => res.json({ params: req.params }));
//named groups not suppoted?
// /regex/hello -> error
app.get(/\/regex2\/(?<groupname>.+)/, (req, res) =>
res.json({ params: req.params })
);

when using named capture groups, I got the following error

TypeError: Cannot read property 'name' of undefined
at Layer.match (webpack:///./node_modules/express/lib/router/layer.js?:147:20)
at matchLayer (webpack:///./node_modules/express/lib/router/index.js?:574:18)
at next (webpack:///./node_modules/express/lib/router/index.js?:220:15)
at cors (webpack:///./node_modules/cors/lib/index.js?:188:7)
at eval (webpack:///./node_modules/cors/lib/index.js?:224:17)
at originCallback (webpack:///./node_modules/cors/lib/index.js?:214:15)
at eval (webpack:///./node_modules/cors/lib/index.js?:219:13)
at optionsCallback (webpack:///./node_modules/cors/lib/index.js?:199:9)
at corsMiddleware (webpack:///./node_modules/cors/lib/index.js?:204:7)
at Layer.handle [as handle_request] (webpack:///./node_modules/express/lib/router/layer.js?:95:5)
at trim_prefix (webpack:///./node_modules/express/lib/router/index.js?:317:13)
at eval (webpack:///./node_modules/express/lib/router/index.js?:284:7)
at Function.process_params (webpack:///./node_modules/express/lib/router/index.js?:335:12)
at next (webpack:///./node_modules/express/lib/router/index.js?:275:10)
at urlencodedParser (webpack:///./node_modules/body-parser/lib/types/urlencoded.js?:91:7)
at Layer.handle [as handle_request] (webpack:///./node_modules/express/lib/router/layer.js?:95:5)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions