HTML5 phone number validation with pattern

后端 未结 5 420
醉酒成梦
醉酒成梦 2020-11-29 21:17

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:

5条回答
  •  隐瞒了意图╮
    2020-11-29 21:50

    The regex validation for india should make sure that +91 is used, then make sure that 7, 8,9 is used after +91 and finally followed by 9 digits.

    /^+91(7\d|8\d|9\d)\d{9}$/

    Your original regex doesn't require a "+" at the front though.

    Get the more information from below link
    w3schools.com/jsref/jsref_obj_regexp.asp

提交回复
热议问题