I want to find valid email addresses in a text file, and this is my code:
email = re.findall(r'[a-zA-Z\.-]+@[\w\.-]+',line)
But my code obviously does not contain email addresses where there are numbers before @ sign. And my code could not handle email addresses that do not have valid ending. So could anyone help me with these two problems? Thank you!
An example of my problem would be:
my code can find this email: xyz@gmail.com
but it cannot find this one: xyz123@gmail.com
And it cannot filter this email out either: xyz@gmail