title: Regular Expression matching at least n of m groups
body: <p>I was going to write a regular expression that would match only if a string contains at least n different classes of characters. I was going to use this to force my users to create strong passwords and wanted to check if the password contains at least 3 of the following:</p>
  
  <ul>
  <li>Characters</li>
  <li>Capital Characters</li>
  <li>Numbers</li>
  <li>Special Characters</li>
  </ul>
  
  <p>Writing a regular expression that matches if all of those classes are present is trivial using lookaheads. However, I cannot wrap my head around the "at least 3" part. Is this even possible (in a nice, compact expression) or would I have to create a monster expression?</p>