前端常用正则

手机号正则

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

 邮编正则

const emailReg=/^[0-9]{6}$/;

整数正则(大于0)

const zsReg=/^(([1-9]d+)|[1-9])?$/; 

小数点后保留2位

const limitReg=/(^[1-9]([0-9]+)?(.[0-9]{1,2})?$)|(^(0){1}$)|(^[0-9].[0-9]([0-9])?$)/;

密码校验,6-20位数字或字母,至少保留1位字母

const pswReg=/^(?![0-9]*$)[a-zA-Z0-9]{6,20}$/;

 身份证号码正则

const idCardReg=/(^d{15}$)|(^d{18}$)|(^d{17}(d|X|x)$)/;
原文地址:https://www.cnblogs.com/gitByLegend/p/11396003.html