JS校验判断姓名
const reg = /^[\u4e00-\u9fa5]{2,8}$/; const name = '呜哈哈1'; console.log(`姓名校验 ${reg.test(name)?'正确':'错误'}`);
JS校验判断手机号
const reg = /^1[3|4|5|7|8]\d{9}$/; const mobil = '1525222222'; console.log(`手机号校验 ${reg.test(mobil)?'正确':'错误'}`);
JS校验判断身份证号码
const reg = /(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/; const userNum = '320333199806060011X'; console.log(`身份证号码校验 ${reg.test(userNum)?'正确':'错误'}`);