src/Parser.php
public function parsePattern($pattern)
    {
        $withoutClosing = rtrim($pattern, "]");
        $closingNumber  = strlen($pattern) - strlen($withoutClosing);

        $segments = preg_split("~" . self::DYNAMIC_REGEX . "(*SKIP)(*F)|\[~x", $withoutClosing);
        $this->parseSegments($segments, $closingNumber, $withoutClosing);

        return $this->buildSegments($segments);
    }
public function parsePattern($pattern)
    {
        $withoutClosing = rtrim($pattern, "]");
        $closingNumber  = strlen($pattern) - strlen($withoutClosing);

        $segments = preg_split("~" . self::DYNAMIC_REGEX . "(*SKIP)(*F)|\[~x", $withoutClosing);
        $this->parseSegments($segments, $closingNumber, $withoutClosing);

        return $this->buildSegments($segments);
    }
public function parsePattern ( $ pattern ) { $ withoutClosing = rtrim ( $ pattern , "]" ) ; $ closingNumber = strlen ( $ pattern ) - strlen ( $ withoutClosing ) ; $ segments = preg_split ( "~" . self :: DYNAMIC_REGEX . "(*SKIP)(*F)|\[~x" , $ withoutClosing ) ; $ this -> parseSegments ( $ segments , $ closingNumber , $ withoutClosing ) ; return $ this -> buildSegments ( $ segments ) ; }
Separate routes pattern with optional parts into n new patterns.

@param string $pattern

@throws BadRouteException
@return array
Separate routes pattern with optional parts into n new patterns .