Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

validate password with 8 Characters, One Uppercase, One Lowercase, One Number and One Special Case Character

  validationSchema2() {
    return Yup.object().shape({
      password: Yup.string()
        .required("Please Enter your new password")
        .min(8)
        .max(40)
        .matches(
          /^(?=.*[A-Z])(?=.*[a-z])(?=.*d)(?=.*[^A-Za-z0-9]).{8,}$/,
          "Must Contain at least 8 Characters, One Uppercase, One Lowercase, One Number and One Special Case Character"
        ),
      confirmPassword: Yup.string()
        .required("Confirm New Password is required")
        .oneOf([Yup.ref("password"), null], "Confirm Password does not match"),
    });
  }
 
PREVIOUS NEXT
Tagged: #validate #password #One #One #One #Number #One #Special #Case #Character
ADD COMMENT
Topic
Name
6+1 =