Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Jul 2002
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question Regular Expressions... confused

    Hi,

    Scenario: A "telephone number" field in the format: +1718231556 where 1 = country code, 718 = area code, 8231556 = actual phone number... but this is beyond my point.

    What's been tried: A strange reg-exp... here goes...

    ^(\+)([0-9]){10,15}+$

    Umm... I'm using a form-validation script found at www.creativeprogrammers.com and they use objects to do the whole form validation. This description is in their instructions:

    regexp=??? -- Check with a regular expression the value should match the regular expression.
    example: "regexp=^[A-Za-z]{1,20}$" allow up to 20 alphabetic characters.

    which is supposed to be put into:
    formValidator.addValidation("telephone_number","regexp=^(\+)([0-9]){10,15}+$","Please enter valid Telephone Number");


    Anyone good at Regular Expressions who can help me? Any help is much appreciated

    I.

  • #2
    jkd
    jkd is offline
    Senior Coder jkd's Avatar
    Join Date
    May 2002
    Location
    metro DC
    Posts
    3,163
    Thanks
    1
    Thanked 18 Times in 18 Posts
    /^\+\d{11}$/

    looks for a + sign followed by 11 digits (1 + area code (3) + phone number (7))


  •  

    Posting Permissions

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