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);
    }
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);
    }
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 ) ; }
Check if the given string matches the given pattern.

Asterisks can be used to indicate wildcards.

@since 3.0.0

@param string $pattern The pattern to check
@param string $givenString the string to compare to the pattern

@return bool
Check if the given string matches the given pattern .