This regex pattern ensures that the password contains at least one lowercase letter, one uppercase letter, one digit, one special character, and is between 8 and 16 characters in length.
^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[^a-zA-Z\d]).{8,16}$
Copy
const passwordRegex = /^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[^a-zA-Z\d]).{8,16}$/;
Copy