fork(6) download
  1. # your code goes here
  2.  
  3. import re
  4.  
  5. postalCode = " 56 Winding Way, Thunder Bay, Ontario, D56 4A3 "
  6.  
  7. #read First Line
  8. line = postalCode
  9.  
  10. if re.search("[ABCEGHJKLMNPRSTVXY][0-9][ABCEGHJKLMNPRSTVWXYZ] ?[0-9][ABCEGHJKLMNPRSTVWXYZ][0-9]", line , re.IGNORECASE | re.DOTALL):
  11. print 'Match found - valid Canadian address: ', line
  12. else:
  13. print 'Error - no match - invalid Canadian address:', line
  14.  
Success #stdin #stdout 0.01s 7736KB
stdin
Standard input is empty
stdout
Error - no match - invalid Canadian address:  56 Winding Way, Thunder Bay, Ontario, D56 4A3