protected function match(Request $request, Route $route) { $currentPath = $this->getCurrentPath($request); $routePath = $route->getPath(); $regex = $route->getRegularExpression(); if ($currentPath == $routePath) { return true; } else { if (!empty($regex) && preg_match('#^' . $regex . '\\/?$#', $currentPath, $matches)) { $request->query->add($route->getNamesParameters($matches)); return true; } } return false; }