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

Ansible - ERROR! the field 'hosts' is required but was not set -

customize file_field button ruby on rails -

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