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 -

SoapUI on windows 10 - high DPI/4K scaling issue -

java - why am i getting a "cannot resolve method" error on getApplication? -