Skip to content

Commit 867bb26

Browse files
authored
Merge pull request #2 from aakash1234567/master
algo to check email
2 parents 13c4e53 + 83b0238 commit 867bb26

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed

emailchecker.py

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# Python program to validate an Email
2+
3+
# import re module
4+
5+
# re module provides support
6+
# for regular expressions
7+
import re
8+
9+
# Make a regular expression
10+
# for validating an Email
11+
regex = '^[a-z0-9]+[\._]?[a-z0-9]+[@]\w+[.]\w{2,3}$'
12+
# for custom mails use: '^[a-z0-9]+[\._]?[a-z0-9]+[@]\w+[.]\w+$'
13+
14+
# Define a function for
15+
# for validating an Email
16+
def check(email):
17+
18+
# pass the regular expression
19+
# and the string in search() method
20+
if(re.search(regex,email)):
21+
print("Valid Email")
22+
23+
else:
24+
print("Invalid Email")
25+
26+
27+
# Driver Code
28+
if __name__ == '__main__' :
29+
30+
# Enter the email
31+
32+
33+
# calling run function
34+
check(email)
35+
36+
37+
check(email)
38+
39+
email = "ankitrai326.com"
40+
check(email)

0 commit comments

Comments
 (0)