title: New Mercosul License Plates Regex
body: <p>New Mercosul License Plates have the following rules:</p>
  
  <ul>
  <li>Must have 7 alphanumeric digits, in which:
  <ul>
  <li>4 are letters (A-Z)</li>
  <li>3 are digits (\d)</li>
  </ul></li>
  <li>Letters and Digits can be shuffled in anyway.</li>
  </ul>
  
  <p>So the following texts are valid: AB123CD, 1A2B3CD, 123ABCD, ABCD123</p>
  
  <p>And these are invalid: ABC1234D, ABCDE12, ABC123, etc</p>
  
  <p>I know I can achieve this via code just checking the string size and count numbers and letters, but this problem make me wonder if that can also be achieved via Regex.</p>
  
  <p>All I could think of is to generate all the possibilities like (\d{3}[A-Z]{4}) , (\d{2}[A-Z]{4}\d) and use | to join them, wich is not practical at all given the large amount of combinations, any other thoughts? Or this is just a case where Regex is a no go?</p>
  
  <p>Edited after Answer:</p>
  
  <p>As @stribizhev posted, this is a typical look Ahead use case. </p>
  
  <p>I found this <a href="http://www.rexegg.com/regex-disambiguation.html#noncap" rel="noreferrer">link</a> a very useful source</p>
  
  <p>And <a href="http://www.rexegg.com/regex-lookarounds.html#password" rel="noreferrer">here's an example</a> on how to perform password validations using lookarounds</p>