/**
* Get the regex pattern to match the request path
* @param $basePath
* @return string
*/
protected function getMatchRegexPattern($basePath)
{
// Convert URL params into regex patterns, construct a regex for this route, init params
$routePattern = is_null($basePath) ? (string) $this->routeMetaData->getRoutePattern() : '/' . $basePath . '/' . ltrim((string) $this->routeMetaData->getRoutePattern(), '/');
$patternAsRegex = preg_replace_callback('#:([\\w]+)\\+?#', [$this, 'matchesCallback'], str_replace(')', ')?', $routePattern));
if (substr($this->routeMetaData->getRoutePattern(), -1) === '/') {
$patternAsRegex .= '?';
}
return $patternAsRegex;
}