diff --git a/Course3/Lab4/validations.py b/Course3/Lab4/validations.py index b18de65a2e..312eea9752 100644 --- a/Course3/Lab4/validations.py +++ b/Course3/Lab4/validations.py @@ -12,7 +12,7 @@ def validate_user(username, minlen): # Usernames can't be shorter than minlen if len(username) < minlen: return False - # Usernames can only use letters, numbers, dots and underscores + # Usernames can only use letters, numbers, not dots and underscores if not re.match('^[a-z0-9._]*$', username): return False # Usernames can't begin with a number @@ -21,4 +21,7 @@ def validate_user(username, minlen): 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