Regular expression to exclude a specific line

I am currently implementing an identity management solution that will give users the ability to manage all of their endpoint accounts.

Currently, our company password policy is Windows-compliant by default: must contain, but is not limited to, a number or special character.

Unfortunately, in the new system password policy, we may need a number, a special number, or both, but not "one of them". However, the new system allows for regular expression validation.

This set is currently set to "REPLACE" with the following regex:

.*[pP][aA4][sS$]{2}[wW][oO0][rR][dD].*

      

It works really well. However, we would like to change this to ALLOW, either a digit or a special one, as well as minus the previous one. Here's what I've tried:

((?=.*\d.*)|(?=.*[-'"!#$%&()*+,./:;<=>?@[\]\^_`{|}~\\].*))(?!.*[pP][aA4][sS$]{2}[wW][oO0][rR][dD].*)

      

However, I can't seem to get this to work. The digit / special command works fine, however the word group does not work. It sees if "password" or some variation is used at the end of the line, but not at the beginning ...

Any suggestions? The system uses standard (Perl-style) regular expressions.

+3


source to share


1 answer


Some tricksters can combine your regular expressions.

^([^pP\d!\-'"#$%&()*+,./:;<=>?@[\]\^_`{|}~\\]|[pP](?![aA4][sS$]{2}[wW][oO0][rR][dD]))*(\d|[-'"!#$%&()*+,./:;<=>?@[\]\^_`{|}~\\])([^pP\d!\-'"#$%&()*+,./:;<=>?@[\]\^_`{|}~\\]|[pP](?![aA4][sS$]{2}[wW][oO0][rR][dD]))*$

      



I have tested this successfully in Sublime text editor.

0


source







All Articles