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();
        }
    }