Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using Regex with Lumen route

Tags:

regex

lumen

I am trying to make a part of route case insensitive, so I tried using (?i) modifier in order achieve that:

(?i)my/route

However, there is a line in nikic router that Lumen is using

$regex .= preg_quote($part, '~');

that replaces regex parts of the url, and at the end my url looks like this:

/\(\?i\)my/route

Is there a way to put regex inside the url in Lumen that I'm not aware of?

like image 403
Zed Avatar asked Feb 04 '16 11:02

Zed


1 Answers

Here is how Lumen handles regexps $app->get('user/{id:[0-9]+}', 'PostController@profile');

https://nikic.github.io/2014/02/18/Fast-request-routing-using-regular-expressions.html

like image 181
Java Avatar answered Oct 13 '22 00:10

Java