import re
def validate_email(email):
pattern =
r'^[\w\.-]+@[\w\.-]+\.\w+$'
if
re.match(pattern, email):
return True
else:
return False
# Test the program
email_to_validate = input("Enter an email address:
")
if validate_email(email_to_validate):
print("Valid
email address")
else:
print("Invalid email address")
No comments:
Post a Comment