Check if current url matches a given regex.

@param  string $regex
@param  mixed  $true  What return if the compare is true
@param  mixed  $false What return if the compare is true
@return mixed
428803
public function match($regex = '', $true = true, $false = "")
    {
        return preg_match("~{$regex}~", $this->path) === 1 ? $true : $false;
    }
325257
public function matchAll($regex)
    {
        $matches = array();
        $result = preg_match_all($regex, $this->toString(), $matches, PREG_SET_ORDER);
        if($this->isValidRegex($regex) && $result!==false && $result>0)
        {
            return ArrayList::asObjectArray($matches);
        }
        return null;
    }
710701
protected function doMatch($actual)
    {
        if (!is_string($actual)) {
            throw new \InvalidArgumentException('PatternMatcher expects a string');
        }

        return (bool) preg_match($this->expected, $actual);
    }
755659
public function addressMatches($regex)
    {
        $actual = $this->getCurrentUrlPath();
        $message = sprintf('Current page "%s" does not match the regex "%s".', $actual, $regex);

        $this->assert((bool) preg_match($regex, $actual), $message);
    }
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;
    }
484723
public function match(String $url, bool $strict, bool $case) {

		//If no strict routing, removing last / of $url if $this->path does not have it
		if(!$strict && $this->path[strlen($this->path) - 1] != '/')
			$url = rtrim($url, '/');

		if($case) 	$case = '';
		else 		$case = 'i';

		//Parameters name
		preg_match_all('/{([\w]+)}/', $this->path, $params);
		$params = $params['1'];

		//Replace default regex and brackets
		$path = preg_replace('/{([\w]+)}/', '([^/{}]+)', $this->path);
		$path = str_replace('\{', '{', $path);
		$path = str_replace('\}', '}', $path);

		//Add the regex if needed (regex array and params array not empty)
		$areRegex = !empty($this->regex) || !empty($params);
		if($areRegex) {
			//Explode the path
			$arrayPath = explode('([^/{}]+)', $path);
			$c = count($arrayPath);
			$path = '';

			//Between each '([^/{}]+)' add the path and the regex
			for($i = 0; $i<$c; $i++) {
				$path .= $arrayPath[$i];

				//The end of the path exploded is ""
				if($c-1 != $i) {
					if(isset($this->regex[$i]))
						$path .= $this->preg($this->regex[$i]);
					elseif(empty($this->regex))
						$path .= '([^/{}]+)';
					else
						$path .= $this->preg($this->regex[0]);
				}
			}
		}

		//Create global regex to match url
		$reg = "#^$path$#$case";

		if(!preg_match($reg, $url, $matches))
			return false;

		//Create an array with the parameters name and the value
		$slugs = array();
		if($areRegex) {
			array_shift($matches);
			$c = count($params);

			for($i = 0; $i<$c; $i++) {
				$slugs[$params[$i]] = $matches[$i];
			}
		}

		$this->slugs = $slugs;

		return true;

	}
616157
public function match($url = null)
    {
        $match = parent::match($url);
        $regex = $this->getRegex($this->getMatchUrl());

        if ($regex !== ' ') {
            if (preg_match("@" . ltrim($regex) . "@si", $this->getRequestedUrl(), $matches) || true === $match) {
                unset($matches[0]);
                ParameterBag::setParameters($matches);
                return true;
            } else {
                return false;
            }
        } else {
            return false;
        }

    }
97272
public function ifMatches(string $regex)
    {
        if ($this->value->isMatchedBy($regex)) {
            return $this->value->value();
        }

        $this->paramErrors->append($this->paramName, 'FIELD_WRONG_VALUE');
        return null;
    }
1354079
protected static function in_array_matches_regex($test, $patterns)
    {
        foreach($patterns as $val) {
            if(@preg_match($val, null) === false) {
                if( strcasecmp($val, $test) === 0 ) {
                    return true;
                }
            } else {
                if( preg_match($val, $test) === 1 ) {
                    return true;
                }
            }
        }
        return false;
    }
674214
public static function is($url, $regexp = false) {
        $r = self::getRouter();
        if ($regexp) {
            return preg_match('`^' . $url . '$`', $r->requestURL);
        }

        return $url == $r->requestURL;
    }
764707
public function checkUrlMatch($pattern, $url)
    {
        $url = trim($url, '/');
        if (!$url) {
            $url = '/';
        }
        $matcher = $this->getPatternRegexp($pattern);
        if (preg_match($matcher, $url, $matches)) {
            return true;
        }
        return false;
    }
337706
protected function _filter($regex, $content, $i = 1, $key = '') {
		if (@preg_match($regex, $content, $match) == 1) {
			$result = isset($match[$i]) ? $match[$i] : $match[0];
			if (isset($this->_callback['_all_'])) {
				foreach ($this->_callback['_all_'] as $filter) {
					$result = call_user_func($filter, $result);
				}
			}
			if ($key != '' && isset($this->_callback[$key])) {
				foreach ($this->_callback[$key] as $filter) {
					$result = call_user_func($filter, $result);
				}
			}
			return $result;
		}
		return false;
	}
282560
private function uriMatchesPattern( $requestUrl, $pattern )
	{
		if ( $requestUrl == $pattern )
		{
			return true;
		}
		elseif ( @preg_match( $pattern, '' ) !== false )
		{
			return boolval( preg_match( $pattern, $requestUrl ) );
		}
		else
		{
			return false;
		}
	}
1325920
public function match($regex)
    {
        $match = array();
        if($this->isValidRegex($regex) && preg_match($regex, $this->toString(), $match)===1)
        {
            return new ObjectArray($match);
        }
        return null;
    }
988550
public static function is_cleanPath($path, $clean = false, $regex = '!_-\w\/\\\ ')
    {
        if ($clean === true) {
            $path = self::get_directPath($path);
        }
        if (preg_match('/[^' . $regex . ']/', $path)) {
            return false;
        }
        return $path;
    }
1158627
public static function isUrl($input = false) {

        if ($input && !filter_var($input, FILTER_VALIDATE_URL) === false) {

            return true;
        }

        return false;
    }
108175
public function matchUrl($method, $url) {
		if ($this->method == $method) {
			if (preg_match('/^' . $this->url . '$/', $url, $matches)) {
				$params = $this->prepareParams($matches);
				$this->execute($params);
				return true;
			}
			return false;
		}
	}