First time I post something here, so I apologize if I'll do something wrong. I tried already looking for the answer in existing topics, but I was not able to find something that was working 100% for my case.
I basically need to build a python RegEx that will match a password with the following requirements:
- At least 1 upper case character
- At least 1 lower case character
- At least 1 digit character
- At least 1 special character between the following !"£$%^&?
- Spaces cannot be included in the password
The minimum length should be 10 characters, the maximum should be 20.
In the following examples:
- Password!123
- Password!123 test test test
I would expect to match "Password!123" in both examples, however in the second example the match should stop ad the "3", the "test" (or part of it) should not be included in the match.
So far I built the following:
\b(?=.*[A-Z])(?=.*[a-z])(?=.*\d)(?=.*[!"£$%^&]).{10,20}
But, according to regexr.com , If I test the following: Password!123 test test test
Then I get this match
Password!123 test test test
While I would like to have the following
Password!123 test test test
Any idea on how I could solve this?
Thanks in advance to anyone that will help!!!
KR
Adriano