Validate Canadian Postal Code Regex

后端 未结 7 2272
[愿得一人]
[愿得一人] 2021-02-20 07:12

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:

         


        
7条回答
  •  死守一世寂寞
    2021-02-20 07:54

    This is a valid expression for a Canadian Postal Code that I use. It will format strictly as A0A 0A0.

    /^[A-Za-z]\d[A-Za-z][ -]?\d[A-Za-z]\d$/
    

提交回复
热议问题