title: How can I use regex to identify a Pan number?
body: <p>I am trying to write a regex which will validate the format of a string to match "AAAAA9999A". The first five digits are "A-Za-z" and the next 4 digits are numbers, with the last digit "A-Za-z".</p>
  
  <p>For this, I wrote my regex as <code>[A-Za-z]{5}\d{4}[A-Za-z]{1}</code></p>
  
  <p>Of course this is not working. </p>
  
  <pre><code>validates_format_of :pan_number, :with =&gt; [A-Za-z]{5}\d{4}[A-Za-z]{1}, :message =&gt; 'is not in a format of AAAAA9999A'
  </code></pre>
  
  <p>What am I doing wrong?</p>
  
  <p>Additionally, I want the fourth character to be one of C, P, H, F, A, T, B, L, J, G instead of A-Z.</p>