1var strongRegex = new RegExp("^(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[!@#\$%\^&\*])(?=.{8,})");
2
3RegEx Description
4^ The password string will start this way
5(?=.*[a-z]) The string must contain at least 1 lowercase alphabetical character
6(?=.*[A-Z]) The string must contain at least 1 uppercase alphabetical character
7(?=.*[0-9]) The string must contain at least 1 numeric character
8(?=.*[!@#$%^&*]) The string must contain at least one special character, but we are escaping reserved RegEx characters to avoid conflict
9(?=.{8,}) The string must be eight characters or longer
10
11by- Nic Raboy
1const isPasswordSecure = (password) => {
2 const re = new RegExp("^(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[!@#\$%\^&\*])(?=.{8,})");
3 return re.test(password);
4};