fork download
  1. # coding=utf8
  2. # the above tag defines encoding for this document and is for Python 2.x compatibility
  3.  
  4. import re
  5.  
  6. regex = r"https?://([^.]+)"
  7.  
  8. test_str = "https://a...content-available-to-author-only...a.net:666/api/v1/"
  9.  
  10. matches = re.search(regex, test_str)
  11.  
  12. if matches:
  13. print(matches.group(1))
  14.  
Success #stdin #stdout 0.01s 7224KB
stdin
Standard input is empty
stdout
ahostnamea