title: PHP check postal code
body: <p>I need to verify the postal code inserted in a text box and stored in a variable: "$code".</p>
  
  <p>iIf the format is like this: <code>XXXX – XXX</code> it's valid. If not, it's invalid (the X's are numbers).</p>
  
  <p>Someone told me to make a regex like this one but applied to my needs:</p>
  
  <pre><code>$regex = "/^[ABCEGHJKLMNPRSTVXY]{1}\d{1}[A-Z]{1} *\d{1}[A-Z]{1}\d{1}$/";
  </code></pre>
  
  <p>Not only do I not know how to make that, but I also don't know what to do after.</p>
  
  <p>Do you guys have any idea on how to solve my problem?</p>