From 2128a24f1ca1a71928390f9ba5f8caed2260abad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20Sessing=C3=B8?= Date: Thu, 10 Dec 2015 01:34:35 +0100 Subject: [PATCH] [FEATURE] Added support for domain regex matching. - Also improved regex matching when using custom regular expressions. --- src/Pecee/SimpleRouter/RouterRoute.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Pecee/SimpleRouter/RouterRoute.php b/src/Pecee/SimpleRouter/RouterRoute.php index 65e75c9..9c17f79 100644 --- a/src/Pecee/SimpleRouter/RouterRoute.php +++ b/src/Pecee/SimpleRouter/RouterRoute.php @@ -26,14 +26,14 @@ class RouterRoute extends RouterEntry { // Match on custom defined regular expression if($this->regexMatch) { $parameters = array(); - if(preg_match('/('.$this->regexMatch.')/is', $url, $parameters)) { + if(preg_match('/('.$this->regexMatch.')/is', request()->getHost() . $url, $parameters)) { $this->parameters = (!is_array($parameters[0]) ? array($parameters[0]) : $parameters[0]); return $this; } + return null; } // Make regular expression based on route - $route = rtrim($this->url, '/') . '/'; $parameterNames = array();