就是下面這個啦:code
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))