I have a script written in JavaScript to Validate Canadian Postal Codes using Regex, however it does not seem to be working. Here is the script:
If statement:
A regex approach can validate the format of a Canadian postcode, but it's not sufficient to guarantee that the postcode actually exists.
For example: A9A 0A0
looks like a valid Canadian postcode, but the forward sortation area A9A
doesn't actually exist.
Are you sure you wouldn't rather do some kind of lookup against an official list of postcodes?