src/ViKon/Parser/lexer/LexerPattern.php
public function split($text) {
        if (count($this->patterns) === 0) {
            return false;
        }
        if ($this->concatenatedPatterns === null) {
            $this->concatenatedPatterns = '/' . implode('|', array_map(function ($pattern) {
                    return $pattern['pattern'];
                }, $this->patterns)) . '/msSi';
        }

        if (!preg_match($this->concatenatedPatterns, $text, $matches)) {
            return false;
        }

        $match = array_shift($matches);
        $patternNo = count($matches) - 1;
        $childRuleName = $this->patterns[$patternNo]['childRuleName'];
        list($first, $end) = preg_split($this->patterns[$patternNo]['pattern'] . 'msSi', $text, 2);

        return [$first, $match, $end, $childRuleName];
    }
public function split($text) {
        if (count($this->patterns) === 0) {
            return false;
        }
        if ($this->concatenatedPatterns === null) {
            $this->concatenatedPatterns = '/' . implode('|', array_map(function ($pattern) {
                    return $pattern['pattern'];
                }, $this->patterns)) . '/msSi';
        }

        if (!preg_match($this->concatenatedPatterns, $text, $matches)) {
            return false;
        }

        $match = array_shift($matches);
        $patternNo = count($matches) - 1;
        $childRuleName = $this->patterns[$patternNo]['childRuleName'];
        list($first, $end) = preg_split($this->patterns[$patternNo]['pattern'] . 'msSi', $text, 2);

        return [$first, $match, $end, $childRuleName];
    }
public function split ( $ text ) { if ( count ( $ this -> patterns ) === 0 ) { return false ; } if ( $ this -> concatenatedPatterns === null ) { $ this -> concatenatedPatterns = '/' . implode ( '|' , array_map ( function ( $ pattern ) { return $ pattern [ 'pattern' ] ; } , $ this -> patterns ) ) . '/msSi' ; } if ( ! preg_match ( $ this -> concatenatedPatterns , $ text , $ matches ) ) { return false ; } $ match = array_shift ( $ matches ) ; $ patternNo = count ( $ matches ) - 1 ; $ childRuleName = $ this -> patterns [ $ patternNo ] [ 'childRuleName' ] ; list ( $ first , $ end ) = preg_split ( $ this -> patterns [ $ patternNo ] [ 'pattern' ] . 'msSi' , $ text , 2 ) ; return [ $ first , $ match , $ end , $ childRuleName ] ; }
Split subject into pieces

@param string $text raw text to split

@return array|bool return array with exploded string chunks
Split subject into pieces