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 181 views
2 answers 302 views
1 answer 173 views
1 answer 132 views
1 answer 161 views
...