From d2cdcdded47a0aff2413956a598a781b719020e4 Mon Sep 17 00:00:00 2001 From: tracer Date: Mon, 24 Oct 2022 18:56:30 +0200 Subject: [PATCH] simplified regex for route creation --- src/Service/Router.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Service/Router.php b/src/Service/Router.php index a2a4975..71c0e8e 100644 --- a/src/Service/Router.php +++ b/src/Service/Router.php @@ -44,7 +44,7 @@ class Router $parameters = $matches[0]; // create regex for route: - $regex = preg_replace(pattern: '/{(?<=).+?(?=)}/', replacement: '([a-zA-Z0-9]*)', subject: $route); + $regex = preg_replace(pattern: '/{.+?}/', replacement: '([a-zA-Z0-9]*)', subject: $route); $regex = '/^' . str_replace(search: "/", replace: '\\/', subject: $regex) . '$/i'; $route = new Route(name: $name, route: $route, regEx: $regex, parameters: $parameters, callback: $callback);