title: RegEx No more than 2 identical consecutive characters and a-Z and 0-9
body: <p><strong>Edit</strong>: Thanks for the advice to make my question clearer :)</p>
  
  <p>The <code>Match</code> is looking for 3 consecutive characters:</p>
  
  <p><code>Regex Match =</code><strong>AaA</strong><code>653219</code><br>
  <code>Regex Match = AA</code><strong>555</strong><code>6219</code></p>
  
  <p>The code is ASP.NET 4.0. Here is the whole function:</p>
  
  <pre><code>public ValidationResult ApplyValidationRules()
  {
      ValidationResult result = new ValidationResult();
      Regex regEx = new Regex(@"^(?=.*\d)(?=.*[a-zA-Z]).{8,20}$");
  
      bool valid = regEx.IsMatch(_Password);
      if (!valid)
          result.Errors.Add("Passwords must be 8-20 characters in length, contain at least one alpha character and one numeric character");
  
      return result;
  }
  </code></pre>
  
  <p>I've tried for over 3 hours to make this work, referencing the below with no luck =/</p>
  
  <p><a href="https://stackoverflow.com/questions/664194/how-can-i-find-repeated-characters-with-a-regex-in-java">How can I find repeated characters with a regex in Java?</a></p>
  
  <p><a href="https://stackoverflow.com/questions/9760443/net-regex-for-more-than-2-consecutive-letters">.net Regex for more than 2 consecutive letters</a></p>
  
  <p>I have started with this for 8-20 characters <code>a-Z</code> <code>0-9</code> :</p>
  
  <pre class="lang-none prettyprint-override"><code>^(?=.*\d)(?=.*[a-zA-Z]).{8,20}$
  </code></pre>
  
  <pre class="lang-vb prettyprint-override"><code>As Regex regEx = new Regex(@"^(?=.*\d)(?=.*[a-zA-Z]).{8,20}$");
  </code></pre>
  
  <p>I've tried adding variations of the below with no luck:</p>
  
  <pre class="lang-none prettyprint-override"><code>/(.)\1{9,}/
  .*([0-9A-Za-z])\\1+.*
  ((\\w)\\2+)+". 
  </code></pre>
  
  <p>Any help would be much appreciated!</p>