regular expression to exclude a specific string <p>I am currently implementing an identity management solution that will provide users the ability to manage all of their endpoint accounts.</p> <p>Currently, our company password policy matches the default Windows requirements: must contain either a number or a special character, among others.</p> <p>Unfortunately, in the new system's password policy, we can require a number, a special, or both, but not "one of either." However, the new system allows validation by regular expression.</p> <p>Currently, we have this set to DISALLOW the following regex:</p> <pre><code>.*[pP][aA4][sS$]{2}[wW][oO0][rR][dD].* </code></pre> <p>This works pretty well. However, we would like to change this to ALLOW either a digit or a special, while also DISALLOWING the previous. Here is what I have tried:</p> <pre><code>((?=.*\d.*)|(?=.*[-'"!#$%&amp;()*+,./:;&lt;=&gt;?@[\]\^_`{|}~\\].*))(?!.*[pP][aA4][sS$]{2}[wW][oO0][rR][dD].*) </code></pre> <p>However, I can't get this to work. The digit/special group works fine, however the word group does not. It does see if "password" or some variation is used at the END of the string, but not at the beginning...</p> <p>Any suggestions? The system uses standard (Perl-style) regular expressions.</p>