-
Notifications
You must be signed in to change notification settings - Fork 282
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
Allow regex in routes #1062
Allow regex in routes #1062
Conversation
I know this is broken code. I'm hoping that somebody who knows D will understand the intent and fix it or replace it with better. |
The problem is that while the implementation in the old naive router implementation is straightforward, implementing this for the new DFA based router is a lot more involved. Apart from that it doesn't mix with the wildcard support, so there would have to be something that tells regex based routes apart from normal ones. Another possibility, which other frameworks offer, is to only support the regex for placeholder variables:
It would then be implemented as step after the basic route matching. |
@s-ludwig As indicated in issue #1061, I don't have much to go on for how routes are supposed to work. I think I imitated the behavior that was in the code for wildcards, if by "wildcard" you mean "*". I don't know anything about a new DFA-based router. Is it documented somewhere? I did note issues with "*" in the comments of the code. The Route constructor is overloaded to accept both a string and a regex.
should work just fine. |
Okay, using separate overloads would indeed avoid the issues in mixing the two approaches. The DFA (erroneously called "tree" in the code, it's really a directed graph) is used by default instead of the linear I'll fix the documentation later, but currently wildcards and placeholder variables are relatively limited (but useful enough for all usual needs):
|
Le 7 avr. 2015 14:05, "Sönke Ludwig" [email protected] a écrit :
The syntax will more likely be Python's named group, which |
Closing this, since the implementation approach doesn't work anymore. I'll open a separate ticket instead. |
Adds regex routes as suggested in issue #1061.