Detect the Domain Name

  • + 0 comments

    import re import sys

    html= sys.stdin.read()

    pattern= r'https?://(?:www.|ww2.)?([a-zA-Z0-9-]+.?[a-zA-Z0-9-]+.[a-zA-Z].?[a-zA-Z])'

    matches=re.findall(pattern,html)

    output=sorted(set(url for url in matches))

    print(';'.join(output))