Checks whether the resolver matches a given pattern and optional translation

@param string          $pattern
@param string|callable $translation

@return boolean
776974
public function matches($pattern, $translation = null)
	{
		return $this->pattern === $pattern and (!$translation or $translation === $this->translation);
	}
751123
public static function isMatch($value, string $pattern): bool
    {
        if (!static::isStringCastable($value)) {
            return false;
        }

        return !!preg_match($pattern, (string) $value);
    }
499962
protected function wildCardMatch($source, $pattern)
    {
        $pattern = preg_quote($pattern, '#');

        $pattern = str_replace('\?' , '.?', $pattern);
        $pattern = str_replace('\*' , '.*?', $pattern);

        return (bool) preg_match('#^' . $pattern . '$#i' , $source);
    }
375024
protected function assertPattern($pattern)
    {
        if (strlen($pattern) == 0) return null;

        $pattern = '/^'. str_replace('/', '\\/', $pattern). '$/';
        if (@preg_match($pattern, null) === false) {
            throw new DefinitionException("invalid regular expression pattern");
        }

        return $pattern;
    }
1053150
public function matches(string $pattern): bool
	{
		return (bool) preg_match('#' . $pattern . '#', $this->request->getPath());
	}
292023
public function matches(string $string, string $pattern): bool
    {
        if ($string === $pattern) {
            return true;
        }
        if (!$this->isPattern($pattern)) {
            return false;
        }
        return (bool)preg_match($this->getRegex($pattern), $string);
    }
1352631
public static function is($pattern, $value)
    {
        $patterns = Arr::wrap($pattern);

        if (empty($patterns)) {
            return false;
        }

        foreach ($patterns as $pattern) {
            // If the given value is an exact match we can of course return true right
            // from the beginning. Otherwise, we will translate asterisks and do an
            // actual pattern match against the two strings to see if they match.
            if ($pattern == $value) {
                return true;
            }

            $pattern = preg_quote($pattern, '#');

            // Asterisks are translated into zero-or-more regular expression wildcards
            // to make it convenient to check if the strings starts with the given
            // pattern such as "library/*", making any string check convenient.
            $pattern = str_replace('\*', '.*', $pattern);

            if (preg_match('#^'.$pattern.'\z#u', $value) === 1) {
                return true;
            }
        }

        return false;
    }
294093
public function matches($pattern): bool
    {
        Assert::typeOf(['string', __CLASS__], $pattern);

        return preg_match((string) $pattern, $this->data) === 1;
    }
100905
public function is($pattern)
    {
        $path   = $this->path();
        $prefix = $this->prefix();

        foreach (func_get_args() as $_pattern) {
            $_pattern = ($_pattern === '*' ? "{$prefix}*" : "{$prefix}/{$_pattern}");
            $_pattern = trim($_pattern, '/');

            empty($_pattern) && $_pattern = '/';

            if (Str::is($_pattern, $path)) {
                return true;
            }
        }

        return false;
    }
82001
public function matchPattern(string $pattern) : Element
    {
        $this->attributes['pattern'] = $pattern;
        return $this->addTest('pattern', function ($value) use ($pattern) {
            return preg_match("@^$pattern$@", trim($value));
        });
    }
469671
public function parse($pattern)
    {
        //reset must be extracted
        $this->mustBeExtracted = array();
        //filter to lower and remove accentued
        $filteredPattern = mb_strtolower($this->remove_accents($pattern));

        $terms = $this->extractTerms($filteredPattern);
        $terms['_domain'] = $this->extractDomain($filteredPattern);
        $terms['_default'] = $this->extractDefault($filteredPattern);

        return $terms;
    }
741181
public static function matchesPattern($pattern, $givenString)
    {
        if ($pattern == $givenString) {
            return true;
        }

        $pattern = preg_quote($pattern, '#');
        $pattern = str_replace('\*', '.*', $pattern) . '\z';

        return (bool)preg_match('#^' . $pattern . '#', $givenString);
    }
500405
public function match($pattern, $subject)
    {
        if (! $this->validate($pattern)) {
            return false;
        }
        
        return $this->getInstance()->match($pattern, $subject);
    }
138789
public static function matches($value, $pattern)
    {
        if (is_array($pattern)) {
            if (!is_array($value) && !$value instanceof \Traversable) {
                return false;
            }

            $keyMatcher = self::key_matcher($pattern);

            foreach ($value as $key => $item) {
                if (! $keyMatcher($key, $item)) return false;
            }

            if (! $keyMatcher()) return false;

            return true;
        }

        return self::matcher($value, $pattern);
    }
321834
protected function checkForValidTranslationInstance($translation)
    {
        return ($translation !== null &&
                $translation instanceof CNabuSiteRoleLanguage &&
                $translation->matchValue($this, 'nb_site_id') &&
                $translation->matchValue($this, 'nb_role_id')
        );
    }
536364
public static function i18n($pattern, array $options = array())
		{

			// Trim the pattern
			$pattern = rtrim($pattern, '/ ');

			// Do the default options
			$options = array_merge(array(
				"controller" => "\\ChickenWire\\I18n\\I18nController"
			), $options);

			// Create basic route for all
			Route::match($pattern, array_merge(array(
				"action" => "all"
			), $options));

			// Get current language
			Route::match($pattern . '/current', array_merge(array(
				"action" => "current"
			), $options));

			// All sub requests
			Route::match($pattern . '/current/{*path}', array_merge(array(
				"action" => "current"
			), $options));

			// All sub requests with a language
			Route::match($pattern . '/{*path}', array_merge(array(
				"action" => "all"
			), $options));

		}
943207
public function transformPatternToRegex($pattern)
    {
        if (!isset($this->patternToRegexpCache[$pattern])) {
            $this->patternToRegexpCache[$pattern] = $this->transformPatternToRegexWithSupportedPolicy($pattern);
        }

        return $this->patternToRegexpCache[$pattern];
    }