Skip to content
Discussion options

You must be logged in to vote
yup.object().shape({
    password: yup
      .string()
      .matches('.*[a-z].*', 'pwd must contain 1 lower case letter')
      .matches('.*[A-Z].*', 'pwd must contain 1 upper case letter')
      .matches('[!@#$%^&*(),.?":{}|<>]', 'pwd must contain 1 special character')
  })

Demo :

https://codesandbox.io/s/yup-pwd-validation-lwo5p

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by bluebill1049
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants