Disable th usade of "-" on {pseudovariables}

This commit is contained in:
kj 2022-01-27 11:17:35 -04:00
parent 4b1585fe6d
commit 81f2d4d665

View File

@ -43,12 +43,12 @@ class Router {
* callback - Contiene el callback en formato Namespace\Clase::Método.
*/
private static function parse($path, $callback) {
preg_match_all('/{([\w-]+)}/s', $path, $matches, PREG_PATTERN_ORDER);
preg_match_all('/{(\w+)}/s', $path, $matches, PREG_PATTERN_ORDER);
$paramNames = $matches[1];
$path = preg_quote($path, '/');
$path = preg_replace(
['/\\\{[\w-]+\\\}/s'],
['/\\\{\w+\\\}/s'],
['([^\/]+)'],
$path);