added postcode validation

This commit is contained in:
2022-10-09 14:32:55 +02:00
parent 8a09d27bf4
commit 274549f04b
4 changed files with 11 additions and 7 deletions

View File

@@ -34,6 +34,11 @@ class Validator:
regex = re.compile(r'^(?=.*[A-Za-z])(?=.*\d)(?=.*[@$!%*#?&])[A-Za-z\d@$!%*#?&]{8,31}$')
return re.fullmatch(regex, input)
@staticmethod
def check_postcode(input):
regex = re.compile(r'\b\d{4}[A-Z]{2}\b')
return re.fullmatch(regex, input)
class InputMenu:
def __init__(self, title):