Writing a regular expression for all the things will take a lot of effort. Instead, you can use pyIsEmail package.
Below text is taken from pyIsEmail website.
pyIsEmail is a no-nonsense approach for checking whether that user-supplied email address could be real.
Regular expressions are cheap to write, but often require maintenance when new top-level domains come out or don’t conform to email addressing features that come back into vogue. pyIsEmail allows you to validate an email address – and even check the domain, if you wish – with one simple call, making your code more readable and faster to write. When you want to know why an email address doesn’t validate, they even provide you with a diagnosis.
Usage
For the simplest usage, import and use the is_email function:
from pyisemail import is_emailaddress = "test@example.com"bool_result = is_email(address)detailed_result = is_email(address, diagnose=True)
You can also check whether the domain used in the email is a valid domain and whether or not it has a valid MX record:
from pyisemail import is_emailaddress = "test@example.com"bool_result_with_dns = is_email(address, check_dns=True)detailed_result_with_dns = is_email(address, check_dns=True, diagnose=True)
These are primary indicators of whether an email address can even be issued at that domain. However, a valid response here is not a guarantee that the email exists, merely that is can exist.
In addition to the base is_email functionality, you can also use the validators by themselves. Check the validator source doc to see how this works.