Created
September 10, 2019 17:29
-
-
Save YohannParis/a2fa8882745c138f360ce35c50980d7f to your computer and use it in GitHub Desktop.
[regex] Canada postal code, strict.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Regular expression to test string is a proper Canadian postal code. | |
* H0H H0H, H0H0H0, H0H-H0H, and h0h0h0 formats are valid. | |
*/ | |
/^[ABCEGHJ-NPRSTVXY][0-9][ABCEGHJ-NPRSTV-Z][ -]?[0-9][ABCEGHJ-NPRSTV-Z][0-9]$/i |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment