For Example, Bank account number cannot have special characters and I would like to validate the user input using Yup
and show error in case of special characters like @,#,$ etc and emoji's.
Main intention here is to know the use of regex
with Yup
.
Note: I can use Yup.oneOf
and restrict the user just to enter the integers.
For Example, Bank account number cannot have special characters and I would like to validate the user input using Yup
and show error in case of special characters like @,#,$ etc and emoji's.
Main intention here is to know the use of regex
with Yup
.
Note: I can use Yup.oneOf
and restrict the user just to enter the integers.
1 Answer
Reset to default 8You can use Yup.matches(/* regex here */, /* error message */)