title: Password validation - adding additional requirments
body: <p>I have some code that currently checks for minimum and maximum lentgh. I want to also require uppercase, lowercase, special char, and numeric. Any suggestions on what to add to this or where I can find some examples? I've been Googling and looking thru this forum and have been trying to add the additional password requirments and have been unsuccessful.</p>
  
  <p>This is what I want to require.</p>
  
  <p>At least eight characters in length
   No more than 20 characters in length
   at least lower-case letter and one upper-case
   at least one special character from: !@#$%^&amp;*()~`-=_+[]{}|:";',./&lt;>?
   at least one number [0-9] character
   Cannot match the account login name or email address</p>
  
  <p>My current password validation code</p>
  
  <pre><code>public static final int MIN_PASSWORD_LENGTH = 8;
  public static final int MAX_PASSWORD_LENGTH = 20;
  
  public static boolean isAcceptablePassword(String password)
  {
      if(TextUtils.isEmpty(password))
          return false;
  
      int len = password.length();
  
      if(len &lt; MIN_PASSWORD_LENGTH || len &gt; MAX_PASSWORD_LENGTH)
          return false;
  
      for(int i = 0; i &lt; len; i++)
      {
          char c = password.charAt(i);
          if (Character.isWhitespace(c))
              return false;
      }
  
      return true;
  }
  </code></pre>