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 284 views
2 answers 418 views
1 answer 278 views
1 answer 233 views
1 answer 267 views
...