'Match regular expression (cached).
Same as :func:`re.match`, except the regex is compiled and cached,
then reused on subsequent matches with the same pattern.'

def _match(self, pattern, string):

    try:
        compiled = self._compiled[pattern]
    except KeyError:
        compiled = self._compiled[pattern] = re.compile(pattern, re.U)
    return compiled.match(string)
