title: javascript regex for password containing at least 8 characters, 1 number, 1 upper and 1 lowercase
body: <p>I am trying to write a regular expression to validate a password which must meet the following criteria:</p>
  
  <ul>
  <li>Contain at least 8 characters </li>
  <li>contain at least 1 number</li>
  <li>contain at least 1 lowercase character (a-z)</li>
  <li>contain at least 1 uppercase character (A-Z)</li>
  <li>contains only 0-9a-zA-Z</li>
  </ul>
  
  <p>I tried the following but it doesn't seem to work.</p>
  
  <p><a href="http://jsfiddle.net/many_tentacles/Hzuc9/" rel="noreferrer">http://jsfiddle.net/many_tentacles/Hzuc9/</a></p>
  
  <pre><code>&lt;input type='button' value='click' class='buttonClick' /&gt;
  &lt;input type='text' /&gt;
  &lt;div&gt;&lt;/div&gt;
  </code></pre>
  
  <p>and...</p>
  
  <pre><code>$(".buttonClick").click(function () {
  
      if ($("input[type=text]").filter(function () {
          return this.value.match(/^(?=.*[0-9])(?=.*[a-z])(?=.*[A-Z])([a-zA-Z0-9]{8})$/);
      })) {
          $("div").text("pass");
      } else {
          $("div").text("fail");
      }
  
  });
  </code></pre>
  
  <p>Any ideas?</p>