def search(self, buf):
match = self._regex.search(self._check_type(buf))<EOL>if match is not None:<EOL><INDENT>start = match.start()<EOL>end = match.end()<EOL>return RegexMatch(self, buf[start:end], start, end, match.groups())<EOL><DEDENT>
Search the provided buffer for a match to the object's regex.

        Search the provided buffer for a match to the object's regex. If the
        *match* is found, returns a :class:`RegexMatch` object, otherwise
        returns ``None``.

        :param buf: Buffer to search for a match.
        :return: :class:`RegexMatch` if matched, None if no match was found.