Results 1 to 2 of 2

Thread: javascript regular Expressions

  1. #1
    Join Date
    Apr 2009
    Posts
    20
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default javascript regular Expressions

    Hai,

    I have one problem that is i need the canada postal code validations using regular expressions the postal code is of 7digits including white space a0E T5R means it is combination of digits and alphabets and a space after 3 digits.using javascript
    please help me to getride from this problem.
    Thanks & Regards
    G.anuradha

  2. #2
    Join Date
    Apr 2009
    Location
    Cognac, France
    Posts
    400
    Thanks
    2
    Thanked 57 Times in 57 Posts

    Default

    Not positive but try validating against this

    /^\s*[abceghj-nprstvxyABCEGHJ-NPRSTVXY]\d[a-zA-Z](\s)?\d[a-zA-Z]\d\s*$/

    I've tested this but it fails against your example.

    My investigations show that Canadian postcodes are formatted a9A 9A9, this code works against that.

    I have also not allowed 'w' or 'z' as the first letter because they are not used yet
    Last edited by forum_amnesiac; 05-12-2009 at 10:29 AM.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •