The Password Policy:
Each password should have at least 3 of these:
Numbers
a-z
A-Z
special characters !@#$%^&*()_+
For example, this list:
12345678
adfghj
AASDFGHJ
!@#$%^&
1234as
1234ASDF
1345!#$%
asdfg!@#$
ASDFGB!#$$
SSRasd
Goodone123
G00done!@#
1@a
Aa1
Should be like this:
Goodone123
G00done!@#
1@a
Aa1
Thanks for helping :)
Let's see what regex can match your passwords:
^ # Start of line
(?: # Start of the alternation group
(?=.*\d)(?=.*[a-z])(?=.*[A-Z]) # Conditions 1, 2, 3
|
(?=.*\d)(?=.*[a-z])(?=.*[!@#$%^&*()_+]) # Conditions 1, 2, 4
|
(?=.*\d)(?=.*[A-Z])(?=.*[!@#$%^&*()_+]) # Conditions 1, 3, 4
|
(?=.*[a-z])(?=.*[A-Z])(?=.*[!@#$%^&*()_+]) # Conditions 2, 3, 4
|
(?=.*[a-z])(?=.*[A-Z])(?=.*[!@#$%^&*()_+]) # Conditions 1, 3, 4
)
.* # The line itself is matched
$ # Up to the end of line
See the regex demo
To invert it, we just need to convert the non-capturing alternation group above to a negative lookahead by a mere replacing the :
with !
:
^ # Start of line
(?! # A negative lookahead
See the online demo
To use this in Notepad++, check Match case
option, and add \R*
at the end of the pattern to also remove linebreaks after the removed lines. A one-line for use in NPP:
^(?!(?=.*\d)(?=.*[a-z])(?=.*[A-Z])|(?=.*\d)(?=.*[a-z])(?=.*[!@#$%^&*()_+])|(?=.*\d)(?=.*[A-Z])(?=.*[!@#$%^&*()_+])|(?=.*[a-z])(?=.*[A-Z])(?=.*[!@#$%^&*()_+])|(?=.*[a-z])(?=.*[A-Z])(?=.*[!@#$%^&*()_+])).*$\R*