From f6d2e0b3b3b7f571dd2058c72f1ef02acfc317b9 Mon Sep 17 00:00:00 2001 From: josebb159 Date: Tue, 30 Sep 2025 16:46:02 +0000 Subject: [PATCH] Closes: #1 --- Course3/Lab4/validations.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/Course3/Lab4/validations.py b/Course3/Lab4/validations.py index b18de65a2e..e0799cb9f8 100644 --- a/Course3/Lab4/validations.py +++ b/Course3/Lab4/validations.py @@ -16,9 +16,16 @@ def validate_user(username, minlen): if not re.match('^[a-z0-9._]*$', username): return False # Usernames can't begin with a number - if username[0].isnumeric(): + if username[0].isnumeric() or username[0] in ['.', '_']: 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