Perhaps you tried to find a password that checks the regular expression, there are a lot of them on the site;)
However, you can use positive images to do this:
re.search(r"(?=.*[az])(?=.*[AZ])(?=.*\d)", "1Az")
And to actually match the string ...
re.search(r"(?=.*[az])(?=.*[AZ])(?=.*\d).{3}", "1Az")
And now, to ensure that the password is 3 characters long:
re.search(r"^(?=.*[az])(?=.*[AZ])(?=.*\d).{3}$", "1Az")
A positive lookahead (?= ... ) ensures that the expression inside is present in the string being tested. Thus, the string must have a lowercase character ( (?=.*[az]) ), an uppercase character ( (?=.*[az]) ) and a digit ( (?=.*\d) ) for the regular expression for 'pass'.
Jerry source share