protected function regexifyPattern($pattern)
    {
        preg_match_all('/(\/?)\(:([^)]*)\)(\??)/', $pattern, $regExPatterns, PREG_SET_ORDER, 0);

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

        foreach ($regExPatterns as $regExPattern) {
            if (!empty($regExPattern[2]) && key_exists($regExPattern[2], $this->patterns)) {
                $replacement = sprintf(
                    '(%s%s)%s',
                    empty($regExPattern[1]) ? '' : '\/',
                    $this->patterns[$regExPattern[2]],
                    $regExPattern[3]
                );

                $pattern     = str_replace(preg_quote($regExPattern[0], '/'), $replacement, $pattern);
            }
        }

        return "/^$pattern$/";
    }
protected function regexifyPattern($pattern)
    {
        preg_match_all('/(\/?)\(:([^)]*)\)(\??)/', $pattern, $regExPatterns, PREG_SET_ORDER, 0);

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

        foreach ($regExPatterns as $regExPattern) {
            if (!empty($regExPattern[2]) && key_exists($regExPattern[2], $this->patterns)) {
                $replacement = sprintf(
                    '(%s%s)%s',
                    empty($regExPattern[1]) ? '' : '\/',
                    $this->patterns[$regExPattern[2]],
                    $regExPattern[3]
                );

                $pattern     = str_replace(preg_quote($regExPattern[0], '/'), $replacement, $pattern);
            }
        }

        return "/^$pattern$/";
    }
protected function regexifyPattern ( $ pattern ) { preg_match_all ( '/(\/?)\(:([^)]*)\)(\??)/' , $ pattern , $ regExPatterns , PREG_SET_ORDER , 0 ) ; $ pattern = preg_quote ( $ pattern , '/' ) ; foreach ( $ regExPatterns as $ regExPattern ) { if ( ! empty ( $ regExPattern [ 2 ] ) && key_exists ( $ regExPattern [ 2 ] , $ this -> patterns ) ) { $ replacement = sprintf ( '(%s%s)%s' , empty ( $ regExPattern [ 1 ] ) ? '' : '\/' , $ this -> patterns [ $ regExPattern [ 2 ] ] , $ regExPattern [ 3 ] ) ; $ pattern = str_replace ( preg_quote ( $ regExPattern [ 0 ] , '/' ) , $ replacement , $ pattern ) ; } } return "/^$pattern$/" ; }
Replace placeholders to regular expressions

@param  string $pattern

@return string
Replace placeholders to regular expressions