Detect the Domain Name

  • + 0 comments
    import re
    import sys
    
    pattern = r'https?://(?:ww.\.)?([\w\.\-]+\.[A-Za-z]{2,4})'
    
    content = sys.stdin.read()
    result = set(re.findall(pattern, content))
    print(';'.join(sorted(result)))