1.车牌号
let carNum = '京A11111'
let careg = '';
var creg = /^[京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼使领A-Z]{1}[A-Z]{1}[A-HJ-NP-Z0-9]{4}[A-HJ-NP-Z0-9挂学警港澳]{1}$/;
//新能源汽车8位
var xreg = /^[京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼使领A-Z]{1}[A-Z]{1}(([0-9]{5}[DF]$)|([DF][A-HJ-NP-Z0-9][0-9]{4}$))/;
if (carNum.length == 7) {
careg = creg.test(carNum);
} else {
careg = xreg.test(carNum);
}
if (!careg) {
wx.showToast({
icon: 'none',
title: '请输入正确车牌号',
})
return;
}
2. 手机号
if (!(/^1[345678]\d{9}$/.test(phone))) {
wx.showToast({
title: '联系电话有误',
duration: 2000,
icon: 'none'
});
return false;
}