+ 2

Have anyone made a better password validator

I just tried out my first program. And this is what a got. It's pretty simple. Consists of two parts: password length validation and symbols validation. For example this password can be accepted: Mypasword123 But this one can't be used: 😂😭😉🤣😊 https://code.sololearn.com/cXD0E9Gdbxx9/?ref=app

19th Jan 2020, 8:12 AM
George Pavlov
George Pavlov - avatar
5 Respuestas
+ 2
Try this too: import re usinput = input("Type in your password: \n") check = re.match(r"(?=.*?[^a-zA-Z0-9])(?=.*?[A-Z])(?=.*?[0-9]).{8,}", usinput) print(usinput) if check: print("strong") else: print("weak")
19th Jan 2020, 1:40 PM
Thống Nguyễn
Thống Nguyễn - avatar
19th Jan 2020, 8:22 AM
David Ashton
David Ashton - avatar
+ 3
David Ashton thanks a lot. I will use your code as the example in my future projects
19th Jan 2020, 8:23 AM
George Pavlov
George Pavlov - avatar
+ 2
import re password= input() x = True while x: if (len(password)<7 or len(password)>999): break elif not re.search("[a-z]",password): break elif not re.search("[0-9]",password): break elif not re.search("[!@#$%&*]",password): break else: print("Strong") x=False break if x: print("Weak")
2nd Aug 2020, 3:05 PM
Ace Coder
Ace Coder - avatar
+ 1
Thống Nguyễn thanks man
19th Jan 2020, 1:42 PM
George Pavlov
George Pavlov - avatar