开发者

validating the mobile numbers

开发者 https://www.devze.com 2023-01-01 12:18 出处:网络
I need a regular expression to validate the mobile number up to 9 digits, if the telephone number starts with 8 otherwise 10 digits needs to be entered. The numbers must sta开发者_开发问答rt either wi

I need a regular expression to validate the mobile number up to 9 digits, if the telephone number starts with 8 otherwise 10 digits needs to be entered. The numbers must sta开发者_开发问答rt either with 9 or 8 with above criteria.


^(8\d{8}|[1-79]\d{9})$


Not sure about the answer, but you should check out this very useful website for reg expressions incase you are interested:

http://www.regexlib.com

http://www.regexlib.com/CheatSheet.aspx


Use the following regular expression to match the phone numbers starting with 8 or 9.

^8|9(8\d{8}|[1-79]\d{9})$
0

精彩评论

暂无评论...
验证码 换一张
取 消