src/Parser.php
public static function tokenize($pattern, $delimiter = '/')
    {
        // Checks if the pattern has some optional segments.
        if (count(preg_split('~' . static::PLACEHOLDER_REGEX . '(*SKIP)(*F)|\[~x', $pattern)) > 1) {
            $tokens = static::_tokenizePattern($pattern, $delimiter);
        } else {
            $tokens = static::_tokenizeSegment($pattern, $delimiter);
        }
        return [
            'optional' => false,
            'greedy'   => '',
            'repeat'   => false,
            'pattern'  => $pattern,
            'tokens'   => $tokens
        ];
    }
public static function tokenize($pattern, $delimiter = '/')
    {
        // Checks if the pattern has some optional segments.
        if (count(preg_split('~' . static::PLACEHOLDER_REGEX . '(*SKIP)(*F)|\[~x', $pattern)) > 1) {
            $tokens = static::_tokenizePattern($pattern, $delimiter);
        } else {
            $tokens = static::_tokenizeSegment($pattern, $delimiter);
        }
        return [
            'optional' => false,
            'greedy'   => '',
            'repeat'   => false,
            'pattern'  => $pattern,
            'tokens'   => $tokens
        ];
    }
Tokenizes a route pattern. Optional segments are identified by square brackets.

@param string $pattern   A route pattern
@param string $delimiter The path delimiter.
@param array             The tokens structure root node.