By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,254 Members | 1,713 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,254 IT Pros & Developers. It's quick & easy.

international phone number testing with javascript

P: n/a
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

Dec 8 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
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)

Dec 8 '05 #2

P: n/a

"Evertjan." <ex**************@interxnl.net> wrote in message
news:Xn********************@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

Dec 8 '05 #3

P: n/a
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)

Dec 8 '05 #4

P: n/a

"Evertjan." <ex**************@interxnl.net> wrote in message
news:Xn********************@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

Dec 8 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.