Hey guys, in this tutorial I will show you at least 3 ways to validate an email in Python. Validate here means to check if an email is valid or not.
We will be using RegEx and 2 libraries: email_validator and flanker.
Similar to the URLs, emails also have a common pattern that can be expressed using RegEx.
Take a look at those examples:
The common point is:
- Starts with a string of characters, which is your username.
- Followed by an
- Followed by a domain name, e.g.
So, we can use the following RegEx to validate an email:
You can run it using
python3 validate_email.py command.