javascript - phone number validation with only one "+" character in first place -


i want check following number in regex expressions,

+78645435748675

87978976435

not valid below

+944+4814674

464641+

4+167464165

this work

^\+?\d+$ 

var regex = /^\+?\d+$/;    var phonenumbers = ['+78645435748675', '87978976435', '+944+4814674', '464641+', '4+167464165'];    phonenumbers.foreach(function(number) {    document.writeln(number.match(regex) + '<br>');  });                                            


Comments

Popular posts from this blog

c++ - list<myClass<int> * > sort -

c - Defining floating point constants, how many digits are useful? -

C# Apple Bonjour - how to monitor service records within Windows -