Hackerss.com

Hackerss.com is a community of amazing hackers

Hackerss is a community for developers, data scientitst, ethical hackers, hardware enthusiasts or any person that want to learn / share their knowledge of any aspect of digital technology.

Create account Log in
hackerss
hackerss

Posted on

Python Validate if a string with email is correct

import re

def validate_email(email):
    if re.match(r'^[a-zA-Z0-9_\-\.][email protected][a-zA-Z0-9_\-\.]+\.[a-zA-Z]{2,5}$', email):
        return True
    return False

print(validate_email('[email protected]'))
print(validate_email('[email protected]'))
print(validate_email('josegmail.com'))
print(validate_email('[email protected]'))
print(validate_email('[email protected]'))
Enter fullscreen mode Exit fullscreen mode

Top comments (0)