src/Router/Routes/Glob.php
public function fnmatch($pattern, $url)
    {
        $quoted = preg_quote($pattern, '~');

        $step1 = strtr($quoted, ['\?' => '[^/]', '\*' => '[^/]*', '/\*\*' => '(?:/.*)?', '#' => '\d+', '\[' => '[',
            '\]' => ']', '\-' => '-', '\{' => '{', '\}' => '}']);

        $step2 = preg_replace_callback('~{[^}]+}~', function ($part) {
            return '(?:' . substr(strtr($part[0], ',', '|'), 1, -1) . ')';
        }, $step1);

        $regex = rawurldecode($step2);
        return (boolean)preg_match("~^{$regex}$~i", $url);
    }
public function fnmatch($pattern, $url)
    {
        $quoted = preg_quote($pattern, '~');

        $step1 = strtr($quoted, ['\?' => '[^/]', '\*' => '[^/]*', '/\*\*' => '(?:/.*)?', '#' => '\d+', '\[' => '[',
            '\]' => ']', '\-' => '-', '\{' => '{', '\}' => '}']);

        $step2 = preg_replace_callback('~{[^}]+}~', function ($part) {
            return '(?:' . substr(strtr($part[0], ',', '|'), 1, -1) . ')';
        }, $step1);

        $regex = rawurldecode($step2);
        return (boolean)preg_match("~^{$regex}$~i", $url);
    }
public function fnmatch ( $ pattern , $ url ) { $ quoted = preg_quote ( $ pattern , '~' ) ; $ step1 = strtr ( $ quoted , [ '\?' => '[^/]' , '\*' => '[^/]*' , '/\*\*' => '(?:/.*)?' , '#' => '\d+' , '\[' => '[' , '\]' => ']' , '\-' => '-' , '\{' => '{' , '\}' => '}' ] ) ; $ step2 = preg_replace_callback ( '~{[^}]+}~' , function ( $ part ) { return '(?:' . substr ( strtr ( $ part [ 0 ] , ',' , '|' ) , 1 , - 1 ) . ')' ; } , $ step1 ) ; $ regex = rawurldecode ( $ step2 ) ; return ( boolean ) preg_match ( "~^{$regex}$~i" , $ url ) ; }
Match url against wildcard pattern.

@param string $pattern
@param string $url
@return boolean
Match url against wildcard pattern .