title: Separated regex and jQuery, prevent repeated characters
body: <p>I've read a lot of Stack Overflow answers about preventing repeated characters, but these are all when the regex string is in one line, like this:</p>
  
  <pre><code>^(?=.{4})(?!.{32})(?!.*(.)\1{4})\w[\w.-]+\w$
  </code></pre>
  
  <p>I'm using this concept for a password validation <a href="http://www.webdesignerdepot.com/2012/01/password-strength-verification-with-jquery/" rel="nofollow">http://www.webdesignerdepot.com/2012/01/password-strength-verification-with-jquery/</a> which means I want a valid class added to a list item each time one of the validation rules is passed.
  There is a list of instructions above the password field, like this:</p>
  
  <pre><code>&lt;ul&gt;
    &lt;li id="letter" class="invalid"&gt;At least &lt;strong&gt;3 letters&lt;/strong&gt;&lt;/li&gt;
    &lt;li id="number" class="invalid"&gt;At least &lt;strong&gt;2 numbers&lt;/strong&gt;&lt;/li&gt;
  &lt;/ul&gt;
  
  &lt;input type="password" id="input-password" name="password" autocomplete="off"&gt;
  </code></pre>
  
  <p>If the users input satisfies this, then the instruction gets a tick next to it.</p>
  
  <p>So, I have:</p>
  
  <pre><code>var pwd = $(this).val();
  
  if ( pwd.match(/[A-z]{3,}/) ) {
          $('#letter').removeClass('invalid').addClass('valid');
      } else {
          $('#letter').removeClass('valid').addClass('invalid');
      }
  if ( pwd.match(/\d{2,}/) ) {
          $('#number').removeClass('invalid').addClass('valid');
      } else {
          $('#number').removeClass('valid').addClass('invalid');
      }
  </code></pre>
  
  <p>I was hoping the {3,} would work, but in this instance, it only validates if the 3 letters are consecutive, not if they occur anywhere in the complete string. e.g. "a1aa" is invalid but "aaa" is valid.  I have read around a lot, but I'm just not understand what is needed in this situation, as I can't find other examples where the regex has been split up like this.</p>
  
  <p>Any help?</p>
  
  <p><strong>Edit</strong></p>
  
  <p>Sorry, as nhahtdh pointed out, the title doesn't make sense in relation to the question!
  I actually have an additional validation requirement which is that the password must not repeat the same letter more than 3 times.  For example, 'mississippi' would not be valid as it has more than 3 instances of the letter 's'.</p>