Checks that string match with pattern

@param string $pattern
@param string $string
@param string $message
167823
protected function assertRegExp($pattern, $string, $message = '')
    {
        \PHPUnit\Framework\Assert::assertRegExp($pattern, $string, $message);
    }
894177
public static function stringContainsWildcardKeyword(string $pattern, string $string): bool
    {
        $pattern = '#\b' . self::wildcardToRegex($pattern) . '\b#i';

        return (bool) preg_match($pattern, $string);
    }
333121
public function setRegexp($pattern)
    {
        $regexp = new RegularExpression();
        $regexp->setPattern($pattern);
        $this->_regexps[] = $regexp;
    }
1019335
public function post(string $pattern, array $param) : void
    {
        $this->call('post', $pattern, $param[0], $param[1], $param);
    }
850574
public function matching ($pattern, &$matches = [], $flags = 0, $offset = 0, $start = 0, $end = null) {
		if (is_null($end)) {
			$end = $this->_length;
		}
		return static::Match($pattern, static::Substring($this->_string, $start, $end), $matches, $flags, $offset);
	}
562256
public function regex($key, $pattern, $message = null)
    {
        if (is_array($key)) {
            foreach ($key as $k => $name) {
                $this->regex($name, is_array($pattern) ? $pattern[$k] : $pattern, $message);
            }
        } else {
            if (isset($this->scope[$key]) && ! (bool)preg_match($pattern, $this->scope[$key])) {
                $this->errors[$key] = sprintf($message !== null ? $message : self::$regexMessage, $key);
            }
        }

        return $this;
    }
155840
public static function checkRegexPattern($pattern)
  {
    $check = @preg_match($pattern, "anything"); // thats the easy way to check a pattern ;)
    if (is_integer($check) == false) return false;
    else return true;
  }
820118
public function regex($subject, string $pattern) : bool
    {
        if (!$pattern) {
            throw new InvalidArgumentException('Arg pattern is empty.');
        }
        if ($subject === null) {
            return false;
        }
        return !!preg_match($pattern, '' . $subject);
    }
1136143
public function isMatch(
        $regexPattern,
        array $regexModifierList,
        $string
    ) {
        foreach ($regexModifierList as $regexModifier) {
            $this->validateRegexModifier($regexModifier);
        }

        $result = preg_match('/' . $regexPattern . '/' . implode('', $regexModifierList), $string);

        if ($result === false) {
            throw new RegexErrorException('Regex error');
        }

        if (preg_last_error() !== PREG_NO_ERROR) {
            throw new RegexErrorException(
                sprintf(
                    'Regex error (error: "%s")',
                    $this->errorMap[preg_last_error()]
                )
            );
        }

        return $result === 1 ? true : false;
    }
1046833
protected static function findPatterns($patternString) {
		$patternString = self::sanitizePatternString($patternString);

		$patternRegExp = self::getPatternRegExp();

		return (preg_match_all($patternRegExp, $patternString, $patternsMatches)) ? $patternsMatches[1] : [];
	}
453223
public function assertNotRegExp($pattern, $message = '')
    {
        Assert::assertNotRegExp($pattern, $this->getData(), $message);

        return $this;
    }
1168107
private static boolean matchesPatternList(final String str, final List<Pattern> patterns) {
        if (patterns != null) {
            for (final Pattern pattern : patterns) {
                if (pattern.matcher(str).matches()) {
                    return true;
                }
            }
        }
        return false;
    }
353435
public static function match($pattern, $value)
    {
        if ($pattern == $value) {
            return true;
        }

        $pattern = preg_quote($pattern, '#');
        if ($pattern !== '/') {
            $pattern = str_replace('\*', '.*', $pattern) . '\z';
        } else {
            $pattern = '/$';
        }

        return (bool) preg_match('#^' . $pattern . '#', $value);
    }
1168601
private function validateRegex($pattern)
    {
        \set_error_handler(['Psy\Exception\ErrorException', 'throwException']);
        try {
            \preg_match($pattern, '');
        } catch (ErrorException $e) {
            \restore_error_handler();
            throw new RuntimeException(\str_replace('preg_match(): ', 'Invalid regular expression: ', $e->getRawMessage()));
        }
        \restore_error_handler();
    }
1559
public static function match($pattern, $string, $option = 'msr', $encoding = null)
    {
        $encoding = $encoding === null ? mb_internal_encoding() : $encoding;

        $encodingBackup = mb_regex_encoding();

        mb_regex_encoding($encoding);

        $result = mb_ereg_match($pattern, $string, $option);

        mb_regex_encoding($encodingBackup);

        return $result;
    }
371390
public function matchesPattern($event, $pattern)
    {
        if ($pattern === '*') {
            return true;
        }

        if ($event == $pattern) {
            return true;
        }

        return fnmatch($pattern, $event);
    }
1167302
public function match($pattern, $subject, &$matches = null, $flags = 0, $offset = 0)
    {
        return $this->sandbox->run('preg_match', [$pattern, $subject, &$matches, $flags, $offset], $this->throw);
    }