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:
This will do for Canadian postal code:
/^[a-z][0-9][a-z][- ]?[0-9][a-z][0-9]$/i
It will allow for the proper X#X #X# format with a space or hyphen.