Detect the Domain Name

  • + 0 comments

    Python 3

    import sys
    import re
    string = sys.stdin.read()
    matches = re.findall(r'https?:\/\/(?:www\.|ww2\.)?([^\/\.\s]*\.[^\/\\\?_"\'\s]*)', string)
    print(';'.join(sorted(set(matches))))