title: Python, Canadian Address RegEx validation
body: <p>Im trying to write a Python script that validates Canadian Addresses using RegEx.</p>
  
  <p>For example this address is valid:</p>
  
  <pre><code> " 123 4th Street, Toronto, Ontario, M1A 1A1 "
  </code></pre>
  
  <p>But this one is not valid:</p>
  
  <pre><code> " 56 Winding Way, Thunder Bay, Ontario, D56 4A3"
  </code></pre>
  
  <p>I have tried many different combinations keeping the rules of Canadian Postal codes such as the last 6 alphanumeric bits cannot contain the letters (D,F,I,O,Q,U,W,Z) but all entries seem to come out as invalid. and I tried 
  " ('^[ABCEGHJKLMNPRSTVXY]{1}\d{1}[A-Z]{1} *\d{1}[A-Z]{1}\d{1}$') " but still invalid</p>
  
  <p>this is what I have so far</p>
  
  <pre><code>    import re
  
  
  postalCode = " 123 4th Street, Toronto, Ontario, M1A 1A1 "
  
  #read First Line
  line = postalCode
  
  #Validation Statement
  test=re.compile('^\d{1}[ABCEGHJKLMNPRSTVXY]{1}\d{1}[A-Z]{1} *\d{1}[A-Z]{1}\d{1}$')
  
  
  if test.match(line) is not None:
      print 'Match found - valid Canadian address: ', line
  else:
      print 'Error - no match - invalid Canadian address:', line
  </code></pre>