maches function yup code example
Example: yup only characters regex validation react
yup.string()
.required("Please enter the required field")
.matches(/^[aA-zZ\s]+$/, "Only alphabets are allowed for this field ")
yup.string()
.required("Please enter the required field")
.matches(/^[aA-zZ\s]+$/, "Only alphabets are allowed for this field ")