Arshad Mehmood

Search the blog

    Replace URLs using Regex

    python1 min read

    Replacing urls with regex is very easy.

    import re
    text = re.sub('http://\S+|https://\S+', '', textWithURLs)