title: Regex for complex Password with upper case, lower case, digit and special characters (Python)
body: <p>First time I post something here, so I apologize if I'll do something wrong.
  I tried already looking for the answer in existing topics, but I was not able to find something that was working 100% for my case.</p>
  
  <p>I basically need to build a python RegEx that will match a password with the following requirements:</p>
  
  <ul>
  <li>At least 1 upper case character</li>
  <li>At least 1 lower case character</li>
  <li>At least 1 digit character</li>
  <li>At least 1 special character between the following !"£$%^&amp;?</li>
  <li>Spaces cannot be included in the password</li>
  </ul>
  
  <p>The minimum length should be 10 characters, the maximum should be 20.</p>
  
  <p>In the following examples:</p>
  
  <ul>
  <li>Password!123</li>
  <li>Password!123 test test test</li>
  </ul>
  
  <p>I would expect to match "Password!123" in both examples, however in the second example the match should stop ad the "3", the "test" (or part of it) should not be included in the match.</p>
  
  <p>So far I built the following:</p>
  
  <pre><code>\b(?=.*[A-Z])(?=.*[a-z])(?=.*\d)(?=.*[!"£$%^&amp;]).{10,20}
  </code></pre>
  
  <p>But, according to regexr.com , If I test the following:
  Password!123 test  test test</p>
  
  <p>Then I get this match</p>
  
  <p><strong>Password!123 test  t</strong>est test</p>
  
  <p>While I would like to have the following</p>
  
  <p><strong>Password!123</strong> test  test test</p>
  
  <p>Any idea on how I could solve this?</p>
  
  <p>Thanks in advance to anyone that will help!!!</p>
  
  <p>KR</p>
  
  <p>Adriano</p>