title: Validating reference code in java
body: <p>i need to validate a reference code that is in the form of 2 letters, 3 numbers and one letter. I've tried using for functions, and have also tried going through each letter individually but its either too messy or it's not giving me the result i want. I've heard you can use regex but i'm not sure how to apply it. Any help would be great. Thanks
  I was told that this works:</p>
  
  <pre><code>reference.matches("[A-z]{2}+[0-9]{3}+[A-z]")
  </code></pre>
  
  <p>but when i run it, no matter what i put into the console that is is incorrect. </p>