/**@name 字符中纯在 */ /**@name 数字 */ export const NUM = new RegExp('[0-9]+'); /**@name 小写英文字符 */ export const LOWER_EN_CHAR = new RegExp('[a-z]+'); /**@name 大写英文字符 */ export const UPPER_EN_CHAR = new RegExp('[A-Z]+'); /**@name 特殊字符 */ export const SPECIAL_CHAR = new RegExp('[~!@#$%^&*()_+|<>,.?/:;\'\\[\\]{}"]+'); // 校验 // 密码规则 8-18位字符,包含大小写字母、数字、特殊字符四者组合 export const isValidOfPassword = (value = '') => { if (!/^.{8,18}$/.test(value)) return false; if (!NUM.test(value)) return false; if (!LOWER_EN_CHAR.test(value)) return false; if (!UPPER_EN_CHAR.test(value)) return false; if (!SPECIAL_CHAR.test(value)) return false; return true; };