diff --git a/Course3/Lab4/validations.py b/Course3/Lab4/validations.py old mode 100644 new mode 100755 index b18de65a2e..a070063230 --- a/Course3/Lab4/validations.py +++ b/Course3/Lab4/validations.py @@ -13,12 +13,18 @@ def validate_user(username, minlen): if len(username) < minlen: return False # Usernames can only use letters, numbers, dots and underscores - if not re.match('^[a-z0-9._]*$', username): + if not re.match('[A-Za-z][\.a-zA-Z_]*$', username): return False # Usernames can't begin with a number if username[0].isnumeric(): return False return True +print(validate_user("blue.kale", 3)) # True +print(validate_user(".blue.kale", 3)) # Currently True, should be False + +print(validate_user("red_quinoa", 4)) # True + +print(validate_user("_red_quinoa", 4)) # Currently True, should be False