code: def expect_re(regexp, buf, pos):
      
      match = regexp.match(buf, pos)
      if not match:
          return None, len(buf)
      return buf[match.start(1):match.end(1)], match.end(0)
docs: Require a regular expression at the current buffer position.