-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathregex.py
33 lines (29 loc) · 839 Bytes
/
regex.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import re
def CheckSecurity(password):
if len(password) < 8:
return 1
elif not re.search(r'[A-Z]', password):
return 2
elif not re.search(r'[0-9]', password):
return 3
elif not re.search(r'[!@#$%^&*(),.?":{}|<>]', password):
return 4
else:
return 5
def isExplicityLetters(input_str):
if re.fullmatch(r'[A-Za-z]+', input_str):
return True
else:
return False
def isExplicityNumbers(input_str):
if re.fullmatch(r'\d+', input_str):
return True
else:
return False
def isExplicityValidEmailAddress(input_str):
# This is a basic email pattern, might not cover all edge cases
pattern = r"[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}"
if re.fullmatch(pattern, input_str):
return True
else:
return False