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
Hi, I'm Zeeshan Mustfai! I'm a software engineer with decent experience in full-stack web development. My tech stack includes JS/TS, React, Native, and anything JS. I keep learning and love football.
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"
)
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
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"
)
Yes