Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 41 additions & 0 deletions python/Email_Validation.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Python program to validate an Email

# import re module

# re module provides support
# for regular expressions
import re

# Make a regular expression
# for validating an Email
regex = r'\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Z|a-z]{2,}\b'

# Define a function for
# for validating an Email


def check(email):

# pass the regular expression
# and the string into the fullmatch() method
if(re.fullmatch(regex, email)):
print("Valid Email")

else:
print("Invalid Email")


# Driver Code
if __name__ == '__main__':

# Enter the email
email = "ankitrai326@gmail.com"

# calling run function
check(email)

email = "my.ownsite@our-earth.org"
check(email)

email = "ankitrai326.com"
check(email)