phone number regular expression problem

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • venu

    #1

    phone number regular expression problem

    Hi,
    I have a different requirement and it is :

    I need to validate a phone number field.
    It may or may not be a US phone number.

    The constraints are :
    *************** ********

    # It should accept any number of numbers
    # any number of - hyphens
    # and one + symbol
    # no other characters and alphabets are allowed

    Thanks in advance

    Venugopal.S

  • Charlie Brown

    #2
    Re: phone number regular expression problem



    ^((\+){0,1}91(\ s){0,1}(\-){0,1}(\s){0,1} ){0,1}98(\s){0, 1}(\-){0,1}(\s){0,1}[1-9]{1}[0-9]{7}$

    Comment

    • Dave

      #3
      Re: phone number regular expression problem

      Hi,

      You should be able to get started with this, at least...

      ^[\d-]*\+?[\d-]*$

      Hope that helps.

      Dave


      venu wrote:[color=blue]
      > Hi,
      > I have a different requirement and it is :
      >
      > I need to validate a phone number field.
      > It may or may not be a US phone number.
      >
      > The constraints are :
      > *************** ********
      >
      > # It should accept any number of numbers
      > # any number of - hyphens
      > # and one + symbol
      > # no other characters and alphabets are allowed
      >
      > Thanks in advance
      >
      > Venugopal.S[/color]

      Comment

      Working...