-
Notifications
You must be signed in to change notification settings - Fork 408
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Regex parameters #127
Comments
Regular expressions are not supported. Supporting them makes diffing and concatenation of route paths too complex (used for nesting routers, prefixing, etc.). Also, in the future I plan on optimizing the route matching by using a trie hash, at which point regex's won't be used internally at all. I suggest using router
.param('bar', function *(bar, next) {
if (!bar.match(/[A-z]+/)) {
return this.status = 404;
}
yield next;
})
.get('/foo/:bar/baz') |
hi @alexmingoia, still not supported? |
@hbakhtiyor Looking back on this request I think it wasn't a great idea. There's almost certainly a better way to achieve what you want to do. What problem do you need to solve that requires regex routes? |
a bit like yours, but make some param is optional |
This project uses
https://github.com/pillarjs/path-to-regexp This issue should remain closed as the router itself doesn't apply much special logic to paths. |
Is there any support for parameter matching using regular expressions? For example, something like this:
foo/qux/baz
would then print outqux
to the console, butfoo/0/baz
would be ignored.The text was updated successfully, but these errors were encountered: