Skip to content
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 underscore at start of placeholder names #102

Closed
torohill opened this issue May 19, 2016 · 1 comment
Closed

Allow underscore at start of placeholder names #102

torohill opened this issue May 19, 2016 · 1 comment

Comments

@torohill
Copy link

Would it be possible to allow underscores at the start of placeholder names? Currently placeholders can only start with letters. PHP variables can start with underscores and I don't see any technical reason that this shouldn't be possible, but perhaps I'm missing something.

The following patch implements the change.

diff -r 00e7c8444f17 vendor/nikic/fast-route/src/RouteParser/Std.php
--- a/vendor/nikic/fast-route/src/RouteParser/Std.php   Wed May 18 09:12:21 2016 +1200
+++ b/vendor/nikic/fast-route/src/RouteParser/Std.php   Fri May 20 11:21:35 2016 +1200
@@ -13,7 +13,7 @@
class Std implements RouteParser {
    const VARIABLE_REGEX = <<<'REGEX'
\{
-    \s* ([a-zA-Z][a-zA-Z0-9_-]*) \s*
+    \s* ([a-zA-Z_][a-zA-Z0-9_-]*) \s*
    (?:
        : \s* ([^{}]*(?:\{(?-1)\}[^{}]*)*)
    )?
\}
@nikic
Copy link
Owner

nikic commented May 20, 2016

Sounds reasonable, done: 30470b6

@nikic nikic closed this as completed May 20, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants