def scan_upto(self, regex):
pos = self.pos<EOL>if self.scan_until(regex) is not None:<EOL><INDENT>self.pos -= len(self.matched())<EOL>self.pos_history.pop(-<NUM_LIT:2>)<EOL>return self.pre_match()[pos:]<EOL><DEDENT>
Scan up to, but not including, the given regex.

    >>> s = Scanner("test string")
    >>> s.scan('t')
    't'
    >>> s.scan_upto(r' ')
    'est'
    >>> s.pos
    4
    >>> s.pos_history
    [0, 1, 4]