JSFiddle - React, Tailwind, and code Playground
JavaScript
function testPwd(val) {
return Boolean(/^(?=.*\d)(?=.*[a-z])(?=.*[A-Z])(?=.*[!@#$%]).{4,8}$/.test(val));
}
console.log(testPwd('1dDs!'));
function testPwd(val) {
return Boolean(/^(?=.*\d)(?=.*[a-z])(?=.*[A-Z])(?=.*[!@#$%]).{4,8}$/.test(val));
}
console.log(testPwd('1dDs!'));