开发者

validating the mobile numbers

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜