title: VAT Number HTML5 Form Pattern
body: <p>So I've got to validate European VAT numbers when a user registers.
  I've got the following pattern set:</p>
  
  <pre><code>^((AT)?U[0-9]{8}|(BE)?0[0-9]{9}|(BG)?[0-9]{9,10}|(CY)?[0-9]{8}L|(CZ)?[0-9]{8,10}|(DE)?[0-9]{9}|(DK)?[0-9]{8}|(EE)?[0-9]{9}|(EL|GR)?[0-9]{9}|(ES)?[0-9A-Z][0-9]{7}[0-9A-Z]|(FI)?[0-9]{8}|(FR)?[0-9A-Z]{2}[0-9]{9}|(GB)?([0-9]{9}([0-9]{3})?|[A-Z]{2}[0-9]{3})|(HU)?[0-9]{8}|(IE)?[0-9]S[0-9]{5}L|(IT)?[0-9]{11}|(LT)?([0-9]{9}|[0-9]{12})|(LU)?[0-9]{8}|(LV)?[0-9]{11}|(MT)?[0-9]{8}|(NL)?[0-9]{9}B[0-9]{2}|(PL)?[0-9]{10}|(PT)?[0-9]{9}|(RO)?[0-9]{2,10}|(SE)?[0-9]{12}|(SI)?[0-9]{8}|(SK)?[0-9]{10})$
  </code></pre>
  
  <p>And I'm also clarifying it in the placeholder/title that they need to: Enter VAT Number: CC0123456789 which includes the CC (Country Code).</p>
  
  <p>However clients still don't seem to understand this and still fill in the VAT number without the Country Code and the pattern doesn't seem to check this if a country code has been entered.</p>
  
  <p>So for example I want people to always enter the country code and their vat number accordingly. As it is now you can either enter BE0123456789 or 0123456789 but the latter is something I specifically do not want.</p>
  
  <p>Is there a way to have the above pattern to force use the Country Code? </p>
  
  <p>Thanks in advance for further information.</p>
  
  <p>Edit: Solution found and optimised code further on for all Europe Countries and some non Europe ones as well!</p>
  
  <pre><code>^(SM[0-9]{5}|(IS|CH)[0-9]{6}|(ATU|DK|FI|LU|MT|SI|HU)[0-9]{8}|(BE0|DE|EE|EL|GR|PT|УНП|IL|RS|UZ)[0-9]{9}|(PL|SK|TR|UA)[0-9]{10}|(AU|IT|LV|HR)[0-9]{11}|(SE|PH)[0-9]{12}|(CA|ID)[0-9]{15}|BG[0-9]{9,10}|CY[0-9]{8}L|CZ[0-9]{8,10}|ES[0-9A-Z][0-9]{7}[0-9A-Z]|FR[0-9A-Z]{2}[0-9]{9}|GB([0-9]{9}([0-9]{3})?|[A-Z]{2}[0-9]{3})|IE[0-9]S[0-9]{5}L|LT([0-9]{9,12}|[0-9]{12})|NL[0-9]{9}B[0-9]{2}|RO[0-9]{2,10}|(ALK|ALJ)[0-9]{8}L|IN[0-9]{11}(V|C)|NO[0-9]{9}MVA|RU[0-9]{10,12}|CHE[0-9]{9}(TVA|MWST|IVA))$
  </code></pre>