I am using following reg expression to validate Indian phone number. I want optional +91
or 0
before 10 digits of phone. How can I do it?
^[789]\d{9}$
you can also use jquery for this length==10){ var validate = true; } else { alert('Please put 10 digit mobile number'); var validate = false; } } else { alert('Not a valid number'); var validate = false; } if(validate){ //number is equal to 10 digit or number is not string enter code here... } Save this answer.
Mobile Number validation criteria:The first digit should contain numbers between 6 to 9. The rest 9 digit can contain any number between 0 to 9. The mobile number can have 11 digits also by including 0 at the starting. The mobile number can be of 12 digits also by including 91 at the starting.
How do I validate a country phone number? EPP-style phone numbers use the format + CCC . NNNNNNNNNN x EEEE , where C is the 1–3 digit country code, N is up to 14 digits, and E is the (optional) extension. The leading plus sign and the dot following the country code are required.
On Google Forms, we'll create a new form, providing a name and description. Then, we'll add the 2 fields we need to our form: name and phone number. The field type for both will be Short answer. That's all there is to it.
You can use ^([0]|\+91)?\d{10}
as starts with 0
or +91
and 10 digits after that.
..but as you must have seen number starts with 7,8 or 9
Then, you should use ^([0]|\+91)?[789]\d{9}$
which means starts with 7
, 8
or 9
and follows 9
digits after that.
Some random matches;
+919802422462
08150166859
This should do
^(0|\+91)?[789]\d{9}$
?
matches preceding character or group optionally..
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With