public function regex()
    {
        // Turn "(/)" into "/?"
        $uri = preg_replace('#\(/\)#', '/?', $this->uri);

        // Create capture group for ":parameter", replaces ":parameter"
        $uri = $this->capture($uri, '/:(' . self::ALLOWED_REGEX . ')/');

        // Create capture group for '{parameter}', replaces "{parameter}"
        $uri = $this->capture($uri, '/{(' . self::ALLOWED_REGEX . ')}/');

        // Add start and end matching
        return (string) '@^' . $uri . '$@D';
    }
public function regex()
    {
        // Turn "(/)" into "/?"
        $uri = preg_replace('#\(/\)#', '/?', $this->uri);

        // Create capture group for ":parameter", replaces ":parameter"
        $uri = $this->capture($uri, '/:(' . self::ALLOWED_REGEX . ')/');

        // Create capture group for '{parameter}', replaces "{parameter}"
        $uri = $this->capture($uri, '/{(' . self::ALLOWED_REGEX . ')}/');

        // Add start and end matching
        return (string) '@^' . $uri . '$@D';
    }
public function regex ( ) { // Turn "(/)" into "/?" $ uri = preg_replace ( '#\(/\)#' , '/?' , $ this -> uri ) ; // Create capture group for ":parameter", replaces ":parameter" $ uri = $ this -> capture ( $ uri , '/:(' . self :: ALLOWED_REGEX . ')/' ) ; // Create capture group for '{parameter}', replaces "{parameter}" $ uri = $ this -> capture ( $ uri , '/{(' . self :: ALLOWED_REGEX . ')}/' ) ; // Add start and end matching return ( string ) '@^' . $ uri . '$@D' ; }
Returns a regular expression pattern from the given URI.

@link https://stackoverflow.com/q/30130913

@return string
Returns a regular expression pattern from the given URI .