Can we use a Regex to match several paths while declaring a route ?
Hi,
It would be nice to have more control over matched parameters as well, such as in Express.js:
https://expressjs.com/en/guide/routing.html#route-parameters
To have more control over the exact string that can be matched by a
route parameter, you can append a regular expression in parentheses (()):
Route path: /user/:userId(\d+)
Request URL: http://localhost:3000/user/42
req.params: {"userId": "42"}
It would reduce the need to do custom routing within components after testing parameters.
Was this ever done? I need this feature for my project
I'm very disappointed that there doesn't seem to be support for regex-based path matching, as the default React Router allows. I may need to return to the standard React Router because of this.
I need this feature too
Most helpful comment
Hi,
It would be nice to have more control over matched parameters as well, such as in Express.js:
https://expressjs.com/en/guide/routing.html#route-parameters
It would reduce the need to do custom routing within components after testing parameters.