Description
Describe the bug
Trying to use a simple regex in the routes config file such as (a|b|c) results in an ErrorException being thrown at SYSTEMPATH/Router/RouteCollection.php at line 1331 with the error of preg_match(): Unknown modifier
Upon investigation i see that the fillRouteParams function is trying to preg_match using pipe (|) as a delimiter, which is not appropriate as the pipe is often used in regular expressions.
CodeIgniter 4 version
rc.3
Affected module(s)
Router
Reverse routing
Expected behavior, and steps to reproduce if appropriate
I expected $route->get('(a|b|c)', "Controller::index/$1", ['as' => 'testname']);
To result in calling Controller:index with either a, b or c passed as first parameter.
The excption is thrown as soon as the route config files is being read.
P.S. I also tried escaping the pipe using \| but that resulted in CodeIgniter\Router\Exceptions\RouterException
thrown in SYSTEMPATH/Router/Exceptions/RouterException.php at line 10
Activity