BdW44222

04. Extract Emails

Jul 30th, 2021
655
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import re
  2.  
  3. data = input()
  4. pattern = r"(^|\s)[a-zA-Z0-9]+((\.|\-|\_)[a-zA-Z0-9]+)*\b\@[a-z]+((\-)[a-z]+)*\.[a-z]+((\.)[a-z]+)*"
  5.  
  6. valid_emails = re.finditer(pattern, data)
  7.  
  8. for email in valid_emails:
  9.     print(email.group())
RAW Paste Data