How to check if an email address is in a string with Python

1 Answer

0 votes
import re

s = "This email: username@email.com is an example only"
m = re.search('[^@]+@[^@]+\.[^@]+', s)

if m:
    print("True")
else:
    print("False")


'''
run:

True

'''

 



answered Jun 30, 2018 by avibootz

Related questions

1 answer 184 views
2 answers 305 views
1 answer 174 views
1 answer 138 views
1 answer 163 views
...