JS 正则同时验证 大写字母,小写字母,数字,特殊字符
文章目录
就是下面这个啦:
const regex = /(?=.*[0-9])(?=.*[A-Z])(?=.*[a-z])(?=.*[\W])(?=.*[\S])^[0-9A-Za-z\S]{6,12}$/g;
const str = `22SS@@ss`;
console.log(regex.test(str))
就是下面这个啦:
const regex = /(?=.*[0-9])(?=.*[A-Z])(?=.*[a-z])(?=.*[\W])(?=.*[\S])^[0-9A-Za-z\S]{6,12}$/g;
const str = `22SS@@ss`;
console.log(regex.test(str))
评论
登录后参与技术讨论,分享你的经验与见解。
登录 / 注册暂无评论