title: Regex pattern for validating password
body: <p>I am working with a small issue, but I don't know how to solve it clearly. I have to validate a generated password, with some constraints: </p>
  
  <ul>
  <li>password length: [8, 24] </li>
  <li>password contains 
  <ul>
  <li>at least 1 lower case character </li>
  <li>at least 1 upper case character </li>
  <li>at least 1 digit </li>
  <li>at least 1 special character (printable based on ASCII code) </li>
  </ul></li>
  </ul>
  
  <p>I've used Regex pattern, but it didn't work correctly with both cases: valid and invalid. </p>
  
  <p>The first RegEx pattern: </p>
  
  <pre><code>def pattern = /(=?.{8,24})((:?[a-z]+)(:?[0-9]+)(:?[A-Z]+)(:?\W+))/ 
  </code></pre>
  
  <p>can check all invalid passwords but not for the valid one. </p>
  
  <p>The second RegEx pattern: </p>
  
  <pre><code>def pattern = /(=?.{8,24})((:?[a-z]*)(:?[0-9]*)(:?[A-Z]*)(:?\W*))/ 
  </code></pre>
  
  <p>can check all valid passwords but not for the invalid one. </p>
  
  <p>I am new to Groovy, so I don't know how to create the correct RegEx pattern to solve this. 
  Could you please help me?</p>