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

Cannot define complex routes , i.e. date #1700

Closed
nowackipawel opened this issue Feb 2, 2019 · 2 comments
Closed

Cannot define complex routes , i.e. date #1700

nowackipawel opened this issue Feb 2, 2019 · 2 comments

Comments

@nowackipawel
Copy link
Contributor

I've tried to define simple placeholder for date:
i.e.:

^20[0-5][0-9]\\-(1[0-2]|0[1-9])\\-(3[0-1]|[0-2][1-9]) // double "-" escaping

or

(20[0-5][0-9]\\-(1[0-2]|0[1-9])\\-(3[0-1]|[0-2][1-9]))

but I get

ErrorException

preg_match(): Unknown modifier '0' search →

SYSTEMPATH/Router/RouteCollection.php at line 1210

I think sth bad is happening here:
RouteCollection.php ::1192:
preg_match_all('/\(([^)]+)\)/', $from, $matches);

@nowackipawel nowackipawel changed the title Cannot define complex routes , i. date Cannot define complex routes , i.e. date Feb 2, 2019
@lonnieezell
Copy link
Member

Well, for starters, those patterns doesn't work for me. When running standalone in Patterns app, I have to remove the \\ escaping for the dash in order for it to accurately match anything. Since the dash is part of the date pattern you're looking, it's treated as part of the string here. Not sure if that is messing the system up or not.

I'll write up a test to give it a try, though.

@lonnieezell
Copy link
Member

Cannot replicate. In the routes file:

$routes->addPlaceholder('date', '(20[0-5][0-9]-(1[0-2]|0[1-9])-(3[0-1]|[0-2][1-9]))');
$routes->get('(:date)', 'Home::dates/$1');

Visiting http://localhost:8081/2018-01-12 takes me where I expect it to.

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