international phone number testing with javascript

Discussion in 'Javascript' started by Mark D Smith, Dec 8, 2005.

  1. Mark D Smith

    Mark D Smith Guest

    Hi

    i have to test a form for valid format of international numbers in the
    format +44.1234567890
    i realize that some countries have 3 numbers after the + but so far apart
    from checking the number has numbers + and a . i have had no luck checking
    for +NN. or +NNN.

    Mark
     
    Mark D Smith, Dec 8, 2005
    #1
    1. Advertising

  2. Mark D Smith

    Evertjan. Guest

    Mark D Smith wrote on 08 dec 2005 in comp.lang.javascript:

    > i have to test a form for valid format of international numbers in the
    > format +44.1234567890
    > i realize that some countries have 3 numbers after the + but so far
    > apart from checking the number has numbers + and a . i have had no
    > luck checking for +NN. or +NNN.
    >


    Not very useful, since:
    the one period is not the accepted standard
    there are also 1 numbered [and 3 numbered] country codes
    the 10 numbers after that are not absolute


    result = /^\+\d{2}\.\d{10}$/.test('+44.1234567890')

    a little better:

    result = /^\+\d{1,3}\.\d{10}$/.test('+44.1234567890')

    --
    Evertjan.
    The Netherlands.
    (Replace all crosses with dots in my emailaddress)
     
    Evertjan., Dec 8, 2005
    #2
    1. Advertising

  3. Mark D Smith

    Mark D Smith Guest

    "Evertjan." <> wrote in message
    news:Xns97267943956B3eejj99@194.109.133.242...
    > Mark D Smith wrote on 08 dec 2005 in comp.lang.javascript:
    >
    > > i have to test a form for valid format of international numbers in the
    > > format +44.1234567890
    > > i realize that some countries have 3 numbers after the + but so far
    > > apart from checking the number has numbers + and a . i have had no
    > > luck checking for +NN. or +NNN.
    > >

    >
    > Not very useful, since:
    > the one period is not the accepted standard
    > there are also 1 numbered [and 3 numbered] country codes
    > the 10 numbers after that are not absolute
    >
    >
    > result = /^\+\d{2}\.\d{10}$/.test('+44.1234567890')
    >
    > a little better:
    >
    > result = /^\+\d{1,3}\.\d{10}$/.test('+44.1234567890')
    >
    > --
    > Evertjan.
    > The Netherlands.
    > (Replace all crosses with dots in my emailaddress)
    >


    Hi

    the format is in use by a few domain resellers that the form i use has to
    send in the above format else the domains will net be accepted.
    thanks for the regexp now i just need to figure out how to code it in
    javascript.

    Mark
     
    Mark D Smith, Dec 8, 2005
    #3
  4. Mark D Smith

    Evertjan. Guest

    Mark D Smith wrote on 08 dec 2005 in comp.lang.javascript:

    >>
    >> result = /^\+\d{2}\.\d{10}$/.test('+44.1234567890')
    >>
    >> a little better:
    >>
    >> result = /^\+\d{1,3}\.\d{10}$/.test('+44.1234567890')

    >
    > the format is in use by a few domain resellers that the form i use has to
    > send in the above format else the domains will net be accepted.
    > thanks for the regexp now i just need to figure out how to code it in
    > javascript.


    But the above is javascript!

    ==============================

    function testMyPhoneFormat(x){
    return /^\+\d{1,3}\.\d{10}$/.test(x)
    }


    --
    Evertjan.
    The Netherlands.
    (Replace all crosses with dots in my emailaddress)
     
    Evertjan., Dec 8, 2005
    #4
  5. Mark D Smith

    Mark D Smith Guest

    "Evertjan." <> wrote in message
    news:Xns97268BADB60A9eejj99@194.109.133.242...
    > Mark D Smith wrote on 08 dec 2005 in comp.lang.javascript:
    >
    > >>
    > >> result = /^\+\d{2}\.\d{10}$/.test('+44.1234567890')
    > >>
    > >> a little better:
    > >>
    > >> result = /^\+\d{1,3}\.\d{10}$/.test('+44.1234567890')

    > >
    > > the format is in use by a few domain resellers that the form i use has

    to
    > > send in the above format else the domains will net be accepted.
    > > thanks for the regexp now i just need to figure out how to code it in
    > > javascript.

    >
    > But the above is javascript!
    >
    > ==============================
    >
    > function testMyPhoneFormat(x){
    > return /^\+\d{1,3}\.\d{10}$/.test(x)
    > }
    >
    >
    > --
    > Evertjan.
    > The Netherlands.
    > (Replace all crosses with dots in my emailaddress)
    >


    Sorry i am not big on javascript, more use to perl.
    it makes sense now.

    thanks

    Mark
     
    Mark D Smith, Dec 8, 2005
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. joemono
    Replies:
    5
    Views:
    13,983
    Roy Johnson
    Oct 3, 2003
  2. Zahoor
    Replies:
    1
    Views:
    834
    Darryl L. Pierce
    Nov 15, 2003
  3. chen selina
    Replies:
    0
    Views:
    903
    chen selina
    Jul 7, 2010
  4. Abhishek
    Replies:
    5
    Views:
    232
    David Mark
    Aug 7, 2008
  5. Rene Ivon Shamberger

    convert Phone Letters to Phone numbers

    Rene Ivon Shamberger, Dec 4, 2012, in forum: C++
    Replies:
    5
    Views:
    433
Loading...

Share This Page