fork download
  1. import re
  2. import sys
  3.  
  4. file = sys.stdin
  5. text = file.read()
  6. main_domain = "happy.com"
  7. subdomains = re.findall(r"^(?:(.+)\.)?%s$" % re.escape(main_domain), text, re.M)
  8. print(subdomains)
Success #stdin #stdout 0.06s 9568KB
stdin
admin.happy.com
nothappy.com
happy.com
stdout
['admin', '']