I have a file with some random text including some random emails. I am trying to write a code that can find out emails with valid domains(gmail.com, outlook.com, hotmail.com) using Regex.
Here is the code I've tried so far:
import requests
import re
email_re= r'[a-zA-Z0-9_.-]+[^!#$%^&*()]@[gmail|hotmail|outlook]+[.com]+'
with open ('emails.txt') as f:
read = f.read()
email_data=re.findall(email_re,read)
print(email_data)
My email.txt file:
sentences in it pythonprac@dummy.com
test@gmail.com
test1@hotmail.com
The post A rough draft for a 5 paragraph essay and then a final draft. appeared first on EssayBishop.
hello@gm.com
Required Output: test@gmail.com, test1@hotmail.com