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
Post a Comment