I'm attempting to use the format: pattern: functionality of Validate.js to make sure a password meets the requirements of at least one upper case, one lower case, one number, and one special character, with a minimum length of 8 and a max of 20. The presence and length function as intended. Anyone got any tips?
password: {
presence: {
allowEmpty: false,
message: "is required",
admin: "required",
label: "Password*",
},
length: {
minimum: 8,
message: "must be at least 8 characters",
maximum: 20,
},
format: {
pattern: /^(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[!|@|#|\$|%|\^|&|\*])(?=.{8,20})/,
}
},