def expect_re(self, regexp):
        """Test against the given regular expression and returns the match object.

        :param regexp: the expression to be tested.
        :returns: the match object.
        """
        prefix_len = self.match_prefix(
            self.prefix, self.next_line(require_prefix=False)
        )
        if prefix_len >= 0:
            match = self._expect_re(regexp, self.pos + prefix_len)
            self.match = match
            return match
        else:
            return None
def expect_re ( self , regexp ) : prefix_len = self . match_prefix ( self . prefix , self . next_line ( require_prefix = False ) ) if prefix_len >= 0 : match = self . _expect_re ( regexp , self . pos + prefix_len ) self . match = match return match else : return None
Test against the given regular expression and returns the match object.

        :param regexp: the expression to be tested.
        :returns: the match object.