public function scan($regexp)
    {
        if (preg_match($regexp, $this->getRemainder(), $matches)) {
            if (strlen($matches[0]) &&
                mb_strpos($this->getRemainder(), $matches[0]) === 0) {
                return $this->setState($matches,
                    $this->head + mb_strlen($matches[0]), $this->head);
            }
        }
        return $this->setState();
    }
public function scan($regexp)
    {
        if (preg_match($regexp, $this->getRemainder(), $matches)) {
            if (strlen($matches[0]) &&
                mb_strpos($this->getRemainder(), $matches[0]) === 0) {
                return $this->setState($matches,
                    $this->head + mb_strlen($matches[0]), $this->head);
            }
        }
        return $this->setState();
    }
public function scan ( $ regexp ) { if ( preg_match ( $ regexp , $ this -> getRemainder ( ) , $ matches ) ) { if ( strlen ( $ matches [ 0 ] ) && mb_strpos ( $ this -> getRemainder ( ) , $ matches [ 0 ] ) === 0 ) { return $ this -> setState ( $ matches , $ this -> head + mb_strlen ( $ matches [ 0 ] ) , $ this -> head ) ; } } return $ this -> setState ( ) ; }
Matches regexp at the current position.

Returns the matched string 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 the current position .