title: Regex to check string for unique characters and prohibited characters
body: <p>I'm writing a password validation regex and I've managed to get 80-90% of the way there but can't incorporate the last two pieces I need and I'm sick of beating my head against the wall so that's where you guys come in ;) </p>
  
  <p>Here is my expression so far:
  </p>
  
  <pre class="lang-none prettyprint-override"><code>^(?!.*(.)\1{3}).*(?=.{8,})(?=.*\d)(?=.*[a-z])(?=.*[A-Z])(?=.*[\Q~!@#$%^&amp;*()-_=+[]{}|;:,.&lt;&gt;/?\E]).*$
  </code></pre>
  
  <p>so in order I have the following rules:</p>
  
  <ol>
  <li><code>(?!.*(.)\1{3})</code> - no more than 3 of the same character in sequence</li>
  <li><code>.*(?=.{8,})</code> - string must be a minimum of 8 characters</li>
  <li><code>(?=.*\d)</code> - must contain at least one digit</li>
  <li><code>(?=.*[a-z])</code> - must contain at least one lower case letter</li>
  <li><code>(?=.*[A-Z])</code> - must contain at least one upper case letter</li>
  <li><code>(?=.\*[\Q~!@#$%^&amp;*()-_=+[]{}|;:,.&lt;&gt;/?\E])</code> - must contain at least one of these special characters</li>
  </ol>
  
  <p>I need to add two more restrictions</p>
  
  <p>1) no character other than an alphanumeric or one of my special characters may appear in the string. So I think I have the basic expression correct:</p>
  
  <pre class="lang-none prettyprint-override"><code>^([\w\Q~!@#$%^&amp;*()-_=+[]{}|;:,.&lt;&gt;/?\E]*)$
  </code></pre>
  
  <p>but when I try to add that into my overall expression it doesn't work or it screws up one of my other conditions, so I'm not sure what I'm doing wrong</p>
  
  <p>2) the string MUST contain 4 unique characters. I cant figure this one out at all.</p>
  
  <p>thanks in advance for any help you can provide</p>