Formik, Yup Password Strength Validation with React
You need to pass an actual RegExp object to matches, not a string. Just replace the double quotes with forward slashes in your password schema: EDIT: Updated to use regex from @Bren password: yup .string() .required(‘Please Enter your password’) .matches( /^(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[!@#\$%\^&\*])(?=.{8,})/, “Must Contain 8 Characters, One Uppercase, One Lowercase, One Number and One Special Case … Read more