0
My password validator isn't working, why
2 Respostas
+ 1
It seems you have problem in your regular expression.
regex is very powerful tool and you can even make all your checks within one expression like This:
regex="^.*(?=.{7,})(=?.*[a-zA-Z])(?=.*\d)(?=.*[!@#$%&*]).*quot;
'''
^.* : Start of string
(?=.{7,}) : Length
(?=.*[a-zA-Z]) : Letters
(?=.*\d) : Digits or more obvious [0-9]
(?=.*[!@#$%&*]) : Special characters
.*$ : End of string
'''
.
It may be complex but it works fine.
0
Try using re.findall(r'0-9'... For digits and re.findall(r'\W'...for special characters. This returns a list that you can check the length of. So if Len(input) > 6 and Len(digit) > 1 and Len(spe_char) > 1 it's strong.