diff --git a/code/site/components/com_pages/dispatcher/router/resolver/regex.php b/code/site/components/com_pages/dispatcher/router/resolver/regex.php index d0e6dcc3b..2f3380585 100644 --- a/code/site/components/com_pages/dispatcher/router/resolver/regex.php +++ b/code/site/components/com_pages/dispatcher/router/resolver/regex.php @@ -77,7 +77,8 @@ protected function _initialize(KObjectConfig $config) '*alnum' => '[0-9A-Za-z]+(,[0-9A-Za-z]+)*', 'alpha' => '[A-Za-z]++', '*alpha' => '[A-Za-z]+(,[A-Za-z]+)*', - 'slug' => '[0-9]++[-]++([0-9A-Za-z-]++)', + 'id' => '[0-9]++[-]++[0-9A-Za-z-]++', + 'slug' => '[^0-9-][a-z-0-9]++', '*' => '.+?', '**' => '.++', '' => '[^/\.]++', @@ -351,8 +352,10 @@ protected function _buildRoute($regex, ComPagesDispatcherRouterRouteInterface $r { $type = $this->_match_types[$type]; - preg_match('/'.$type.'/', $value, $matches); - $value = $matches[1] ?? $value; + //Get first capturing group if it exists, if not use full match + if(preg_match('/'.$type.'/', $value, $matches)) { + $value = $matches[0] ?? $value; + } } //Part is found, replace for param value