I have the below rules and using validate.js but regex does not seem to work. Below is my code.
Condition given : Check if string has at least one capital letter, at least one symbol and at least one number
password: {
presence: {
message: '^Please enter a password'
},
length: {
minimum: 5,
message: '^Your password must be at least 6 characters'
},
format: {
pattern: /^(?=.*\d)(?=.*[a-z])(?=.*[A-Z])[\w~@#$%^&+=`|{}:;!.?\""()\[\]-]{1,}$/,
message:
'^Must contain a capital, lowercase, number and a special character!'
}
}