Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

how to extract domain name from url python

import re


def domain_name(url):
 	pattern = re.compile(r'(https?://|www.)?(www.)?([a-z0-9-]+)(..+)?')

    subbed_url = pattern.sub(r'3', url)
    
    return subbed_url
 
PREVIOUS NEXT
Tagged: #extract #domain #url #python
ADD COMMENT
Topic
Name
5+2 =