I want regex for mobile number validation in java script that may be 10 digit to 20 digit and separated by comma
ex;
the user can enter 10 digit phone number alone (1234567890) or enter 10 to 20 digit phone number(1234567890123465),on both numbers separated by comma (1234567890,123456789043543,1234567890345,) but if once he going to enter a number ,it should be 10 digit to 20 digit and it may start with ‘+91’ or ‘0’ like this
Thanks in advance
This regex should work.
\+91\d{8,18}means starts with+91after that there can be more 8-18 digits. As there is 2 digits already in the beginning (91) total digits will be 10-20.0\d{0,19} has also same meaning like above.
If you want to match strings like 123456789043543,1234567890345 etc which does not start with either
+91or0Then simple/^+\d{10-20}(,\d{10-20})*$/gwill do.