def guarded_match(pattern, excerpt, pos=0):
    """Does a regexp match, avoiding any escaped characters in the match.

    :Parameters:
      - `pattern`: compiled regexp pattern
      - `excerpt`: excerpt of text that should be matched
      - `pos`: starting position of the match

    :type pattern: re.pattern
    :type excerpt: preprocessor.Excerpt
    :type pos: int

    :Return:
      The match object.  If no match was found, `None`.

    :rtype: re.match
    """
    return pattern.match(excerpt.escaped_text(), pos)