I'm using HTML5 form validation to validate phone numbers from India.
Phone numbers from India are 10 digits long, and start with 7, 8, or 9.
For example:
7878787878
9898989898
8678678878
These phone numbers are valid, but
1212121212
3434545464
6545432322
are invalid.
Suggest a pattern that can detect valid India phone numbers.
So far, my pattern is [0-9]{10}, but it doesn't check if the first digit is 7, 8, or 9.
Answer:-
How about this? /(7|8|9)\d{9}/
It starts by either looking for 7 or 8 or 9, and then followed by 9 digits.