'Apply `pattern` on the current position and return
the match object. (Doesn\'t touch pos). Use this for
lookahead.'

def check(self, pattern):

    if self.eos:
        raise EndOfText()
    if (pattern not in self._re_cache):
        self._re_cache[pattern] = re.compile(pattern, self.flags)
    return self._re_cache[pattern].match(self.data, self.pos)
