public function createRegexFromName(string $name) : string
    {
        $route = $this->routeCollection->getNamedRoute($name);

        if ($route === null) {
            return '#^.*$#';
        }

        $strippedPathRegex = substr($route->getPathRegex(), 2, -2);

        if (empty($route->getRawHost())) {
            return "#^$strippedPathRegex$#";
        }

        $protocolRegex = preg_quote('http' . ($route->isSecure() ? 's' : '') . '://', '#');
        $strippedHostRegex = substr($route->getHostRegex(), 2, -2);

        return "#^$protocolRegex$strippedHostRegex$strippedPathRegex$#";
    }