def _remove_links(self, string) -> str:
        """Removes all URLs from a given string, leaving only the base domain name."""

        def replace_match(match):
            text = match.group(1)
            return text if text else ""

        url_pattern = r"https?://(?:www\.)?((?!www\.).)+?"
        return re.sub(url_pattern, replace_match, string)
Removes all URLs from a given string, leaving only the base domain name.
llama-index-integrations/readers/llama-index-readers-telegram/llama_index/readers/telegram/base.py