title: Java Regex for password validation
body: <p>I have created regex for password validation in a Java app. The regex I created is below for below requirement.</p>
  
  <pre><code>^[\\p{Alnum}#.!@$*&amp;_]{5,12}$
  </code></pre>
  
  <ol>
  <li>At least 5 chars and max 12 chars </li>
  <li>Contains at least one digit</li>
  <li>Contains at least one char    </li>
  <li>may contain chars within a set of special chars (#.!@$*&amp;_)</li>
  <li>Does not contain space, tab, etc.</li>
  </ol>
  
  <p>I am missing 1 and 2 like if I give "gjsajhgjhagfj" or "29837846876", it should fail. But it's not happening.</p>
  
  <p>Could anyone help please?</p>