Add a convenient pattern matcher to the internal array for use with all routes

@param string $alias
@param string $regex

@return self
554127
public function addPatternMatcher(string $alias, string $regex) : self
    {
        $pattern = '/{(.+?):' . $alias . '}/';
        $regex   = '{$1:' . $regex . '}';

        $this->patternMatchers[$pattern] = $regex;

        return $this;
    }
226138
public function assert(string $key, string $regex): self
    {
        return $this->setRequirement($key, $regex);
    }
83868
public function resolve($alias)
	{
		// Check wether the alias matches the pattern
		if ( ! preg_match($this->regex, $alias, $matches))
		{
			return false;
		}

		// Get the translation
		$translation = $this->translation;

		if (strpos($translation, '$') === false)
		{
			$class = $translation;
		}
		else
		{
			// Make sure namespace seperators are escaped
			$translation = str_replace('\\', '\\\\', $translation);

			// Resolve the replacement
			$class = preg_replace($this->regex, $translation, $alias);
		}

		// Check wether the class exists
		if ($class and $this->objectExists($class, true))
		{
			return $class;
		}

		return false;
	}
831012
public function capture(string $regex): MapInterface
    {
        if (\func_num_args() !== 1) {
            throw new LogicException('Offset and flags are no longer supported');
        }

        return RegExp::of($regex)->capture($this);
    }
571933
public function pageTextNotMatches($regex)
    {
        $actual = $this->session->getPage()->getText();
        $message = sprintf('The pattern %s was found in the text of the current page, but it should not.', $regex);

        $this->assertResponseText(!preg_match($regex, $actual), $message);
    }
661331
private function replaceTurnipAlternativeWordsWithRegex($regex)
    {
        $regex = preg_replace(self::ALTERNATIVE_WORD_REGEXP, '(?:\1|\2)', $regex);
        $regex = $this->removeEscapingOfAlternationSyntax($regex);

        return $regex;
    }
188476
private function matchUri(string $regex, string $uri): ?array
    {
        if (preg_match_all('/' . $regex . '/', $uri, $uriMatches)) {
            $uriMatches = array_filter($uriMatches, function ($key) {
                if (is_string($key)) {
                    return true;
                }

                return false;
            }, ARRAY_FILTER_USE_KEY);

            $uriMatches = array_map(function ($match) {
                return $match[0];
            }, $uriMatches);

            return $uriMatches;
        }

        return null;
    }
771106
public function getMatches(
        string $regex,
        int $offset = 0,
        int $flags = self::PREG_NO_FLAGS
    ): MapInterface {
        return $this->capture($regex, $offset, $flags);
    }
826394
protected function findFilesAsSplFileInfo(string $regex, string $path) {
		
		$objects = new RecursiveIteratorIterator(
			new RecursiveDirectoryIterator($path), 
			RecursiveIteratorIterator::SELF_FIRST
		);
		
		$filter = new RegexIterator($objects, $regex);
		$map = [];
		
		foreach ($filter as $entry) {
			$map[] = $entry;
		}
		
		return count($map) > 0 ? $map : [];
	}
727676
public function alias($alias = null)
    {
        if ($alias === null) {
            return $this->_alias;
        }
        $this->_alias = $alias;

        return $this;
    }
984949
protected static function replaceWildcards($regex)
    {
        preg_match_all(chr(1) . '\(\\*([a-z][a-zA-Z0-9]*)\)' . chr(1), $regex, $matches, PREG_SET_ORDER);

        foreach ($matches as $match) {
            $name = $match[1];

            $regex = str_replace("(*{$name})", "(?P<{$name}>.*)", $regex);
        }

        return $regex;
    }
1031720
public function addAlias($routeName, $alias)
    {
        if(is_array($alias))
            foreach($alias as $item)
                $this->aliasIndices[$item] = $routeName;
        else
            $this->aliasIndices[$alias] = $routeName;

        return $this;
    }
709312
public function whereRegex($field, $regex, $flags = '')
    {
        foreach ($this->queries as $query) {
            $query->whereRegex($field, $regex, $flags);
        }

        return $this;
    }
775241
protected function aliasToMatcher($alias)
    {
        foreach ($this->matchers as $class => $aliases) {
            if (in_array($alias, $aliases)) {
                return $class;
            }
        }

        throw new Exceptions\UnknownAliasException($alias);
    }
906597
public function addRouteAlias($routeName, $alias)
    {
        if(is_array($alias))
            foreach($alias as $item)
                $this->aliasIndices[$item] = $routeName;
        else
            $this->aliasIndices[$alias] = $routeName;

        return $this;
    }
1197939
public function regex($regex, $error) {
        if ($this->_exist) {
            array_push($this->_constraints, ['type' => self::REGEX, 'value' => $regex, 'message' => $error]);
        }

        return $this;
    }
749664
protected function toRegex($regex, $modifiers = '')
	{
		$regex = $regex instanceof RegularExpressionContract ? $regex : Regex::from($regex);
		$regex->addModifiers($modifiers.Modifiers::UTF8);
		return $regex;
	}