Regex E -Mail Python
from re import search
matches = search("/^[a-zA-Z0-9.!#$%&’*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/",
text_to_search)
John Appleseed
from re import search
matches = search("/^[a-zA-Z0-9.!#$%&’*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/",
text_to_search)
# How To Validate An Email Address In Python
# Using "re" package
import re
regex = '^[a-z0-9]+[\._]?[a-z0-9]+[@]\w+[.]\w{2,3}$'
def check(email):
if(re.search(regex,email)):
print("Valid Email")
else:
print("Invalid Email")
if __name__ == '__main__' :
email = "[email protected]"
check(email)
email = "[email protected]"
check(email)
email = "[email protected]"
check(email)