presiannedyalkov
1/17/2020 - 11:41 PM

Test password

// A password with at least one lowercase, one uppercase, one numeral and one special (as per OWASP) character with a min length of 8
const pattern = /^(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[ !"#$%&'()*+,-./:;<=>?@[\]^_`{|}~])[a-zA-Z0-9 !"#$%&'()*+,-./:;<=>?@[\]^_`{|}~]{8,}$/;
const pwd1 = "My1crazypwd!";
const pwd2 = "mynormalpwd";
pattern.test(pwd1);    // → true
pattern.test(pwd2);    // → false