About mobile number validator
Check that a number is a valid 10-digit Indian mobile number and tidy it up.
The rules
- Indian mobile numbers have 10 digits and start with 6, 7, 8 or 9.
- The country code +91 or a leading 0 is removed before checking.
- Spaces and dashes are ignored.
What it cannot do
It checks the format only. It cannot tell whether a number is active or who owns it. To verify ownership, send an OTP.
A worked example
The number 98765 43210 is accepted, because it has ten digits and starts with 9. The number 51234 56789 is rejected, since Indian mobile numbers start with 6, 7, 8 or 9. The number +91 98765 43210 is cleaned to 9876543210.
Using it on a form
Validate on your own server as well as in the browser, and consider an OTP when you must be sure that the person owns the number.
