File tree Expand file tree Collapse file tree 1 file changed +40
-0
lines changed Expand file tree Collapse file tree 1 file changed +40
-0
lines changed Original file line number Diff line number Diff line change
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 )
You can’t perform that action at this time.
0 commit comments