def rex_search(
        self,
        regexp: str | bytes | Pattern[str] | Pattern[bytes],
        flags: int = 0,
        default: Any = UNDEFINED,
    ) -> Any:
        """Search the regular expression in response body.

        Return found match object or None
        """
        match: None | Match[bytes] | Match[str] = None
        assert self.body is not None
        if isinstance(regexp, (bytes, str)):
            regexp = re.compile(regexp, flags=flags)
        match = (
            regexp.search(self.body)
            if isinstance(regexp.pattern, bytes)
            else regexp.search(self.unicode_body())
        )
        if match:
            return match
        if default is UNDEFINED:
            raise DataNotFound("Could not find regexp: %s" % regexp)
        return default
Search the regular expression in response body.

        Return found match object or None
        
grab/document.py