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 = "rohit.gupta@mcnsolutions.net"
check(email)
email = "praveen@c-sharpcorner.com"
check(email)
email = "inform2atul@gmail.com"
check(email)
import re
x = 'Imagine this is the email address: 6775.love@everywhere.com'
y = re.findall('S+@S+', x)
# according to the expression it will look for a string with @ sign
# and which starts and end with a space
print(y) # Output: ['6775.love@everywhere.com']