<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def scan_upto(self, regex):
 """ Scan up to, but not including, the given regex. 't' 'est' 4 [0, 1, 4] """

        pos = self.pos
        if self.scan_until(regex) is not None:
            self.pos -= len(self.matched())
            # Remove the intermediate position history entry.
            self.pos_history.pop(-2)
            return self.pre_match()[pos:]