在此记录一下,表单中的联系方式需要同时校验手机号码和固定电话。
//联系方式
const lxfs = /^((0\d{2,3}-?\d{7,8})|(1[3465789]\d{9}))$/;
还有另外几种
//邮箱
const email = /\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*/;
//手机
const phone = /^1[3465789]\d{9}$/
//固定电话
const tel=/^0\d{2,3}-?\d{7,8}$/
//数字
const number=/^\d*$/