/** * * Expands param names in the regex to named subpatterns. * * @return null * */ protected function setRegexParams() { $find = '#{([a-z][a-zA-Z0-9_]*)}#'; preg_match_all($find, $this->regex, $matches, PREG_SET_ORDER); foreach ($matches as $match) { $name = $match[1]; $subpattern = $this->getSubpattern($name); $this->regex = str_replace("{{$name}}", $subpattern, $this->regex); if (!isset($this->route->values[$name])) { $this->route->addValues(array($name => null)); } } }