DEV Community

Discussion on: Top 5 form validation libraries in React JS and Next JS

Collapse
 
ankur131198 profile image
ANKUR SHARMA

There is very simple way to validate emails with Yup like you only write Yup.email().required (). Now, you can't write the complex regex for the validation of the emails

Collapse
 
zeeshanmustfai profile image
ZeeshanMustfai

We can also write your own regex for complex email validation. for example
Yup.string()
.required("Email is required")
.matches(
/^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+.[a-zA-Z]{2,4}$/,
"Invalid email format"
)

Collapse
 
ankur131198 profile image
ANKUR SHARMA

Yes