public function scanUntil($regexp)
    {
        if (preg_match($regexp, $this->getRemainder(), $matches)) {
            if (!strlen($matches[0])) {
                return $this->setState();
            }
            $index = mb_strpos($this->getRemainder(), $matches[0]);
            $this->setState($matches,
                $this->head + $index + mb_strlen($matches[0]), $this->head);
            return mb_substr($this->source, $this->last,
                $this->head - $this->last);
        } else {
            return $this->setState();
        }
    }
public function scanUntil($regexp)
    {
        if (preg_match($regexp, $this->getRemainder(), $matches)) {
            if (!strlen($matches[0])) {
                return $this->setState();
            }
            $index = mb_strpos($this->getRemainder(), $matches[0]);
            $this->setState($matches,
                $this->head + $index + mb_strlen($matches[0]), $this->head);
            return mb_substr($this->source, $this->last,
                $this->head - $this->last);
        } else {
            return $this->setState();
        }
    }
public function scanUntil ( $ regexp ) { if ( preg_match ( $ regexp , $ this -> getRemainder ( ) , $ matches ) ) { if ( ! strlen ( $ matches [ 0 ] ) ) { return $ this -> setState ( ) ; } $ index = mb_strpos ( $ this -> getRemainder ( ) , $ matches [ 0 ] ) ; $ this -> setState ( $ matches , $ this -> head + $ index + mb_strlen ( $ matches [ 0 ] ) , $ this -> head ) ; return mb_substr ( $ this -> source , $ this -> last , $ this -> head - $ this -> last ) ; } else { return $ this -> setState ( ) ; } }
Matches regexp at or after the current position.

Returns the portion of the source string after the scanner’s position
up to and including the end of the match and advances the scanner’s
position, or returns null if there is no match.

@param string $regexp The regular expression to match.

@return string|null
Matches regexp at or after the current position .