I want to create a validator for the correctness of the entered password, which should contain an uppercase letter, a lowercase letter, a number and a special character. I wanted to do this through a regular expression, but I have trouble creating the correct pattern. Can you help and point out what’s wrong with this code?
print (‘Create a password, which include: uppercase, lowercase, digits and special characters.’)
password = input()
pattern = re.compile (r’ [a-z] & [A-Z] & [0-9] & [!@#$%^&*]’)
validation = pattern.search(password)
if validation:
print (‘Your password is corect’)
else:
print(‘Your password is uncorect’)
created
last reply
- 2
replies
- 521
views
- 2
users
- 1
link