正则表达式验证手机号码

 1、国内手机号验证表达式

const res = /^1[3456789]\d{9}$/;

if (res.test('要验证的手机号')) alert('验证通过')

else alert('验证失败')

 2、国内固话验证表达式(待定)

const res = /^0\d{2,3}-\d{7,8}$/;

发布了4 篇原创文章 · 获赞 1 · 访问量 12

猜你喜欢

转载自blog.csdn.net/qq_41870566/article/details/105451589
今日推荐