fornakter

regex_email

Jul 9th, 2022 (edited)
207
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.27 KB | None | 0 0
  1. import re
  2.  
  3. regex = re.compile(r'\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Z|a-z]{2,}\b')
  4.  
  5. with open(path, 'rt') as f:
  6.     for line in f:
  7.         if re.fullmatch(regex, line):
  8.             pass
  9.         else:
  10.             #print("Invalid email")
  11.             print(line)
Add Comment
Please, Sign In to add comment