title: Password Regular expression validation?
body: <p>I got 2 password fields called password and confirm password. I managed to validate it to make sure that the passwords must match. However, I do not know how to add regular expressions to  the password field to allow it 6 characters long, containing at least an uppercase and a number. </p>
  
  <p>This is the javascript i got so far</p>
  
  <pre><code>&lt;script type="text/javascript" language="javascript"&gt;
  
  function validatepw() {
    if ( document.register.user_password.value != document.register.user_password_confirm.value)
      {
      alert('Passwords did not match!');
          return false;
          }else{
          document.register.submit();
          return true;
      }
      }
  &lt;/script&gt;
  </code></pre>
  
  <p>and this is my form</p>
  
  <pre><code>&lt;form name="register" action="signup.php" onsubmit="return validate_reg()" 
  enctype="multipart/form-data" method="post" &gt;
  
  &lt;table width="600" border="0"&gt;
  &lt;tr&gt;&lt;td width="210" height="45"&gt;Username*:&lt;/td&gt;&lt;td&gt;
  &lt;input type="text" size="40" name="userUsername" id="user_username" /&gt;&lt;/td&gt;&lt;/tr&gt;
  &lt;tr&gt;&lt;td width="210" height="45"&gt;Password*:&lt;/td&gt;&lt;td&gt;
  &lt;input type="password" size="40" name="userPassword" id="user_password"/&gt;&lt;/td&gt;&lt;/tr&gt; 
      &lt;tr&gt;&lt;td width="210" height="45"&gt;Re-type Password:&lt;/td&gt;&lt;td&gt;
  &lt;input type="password" size="40" name="userPasswordConfirm" 
  id="user_password_confirm" onchange="javascript:validatepw()"/&gt;&lt;/td&gt;&lt;/tr&gt;
  &lt;/table&gt;
  &lt;center&gt;&lt;input type="submit" class="button" name="submit" value="register"&gt;&lt;/center&gt;    
  &lt;/form&gt;
  </code></pre>
  
  <p>Can anyone show how to apply the regular expression of 6 characters, an uppercase and a number to the password field. I have searched a lot and cant find anything that works with what i already got.</p>