@MimieveshofuoSubmitted over 3 years ago
Please I need feedback on how to make the email return the error message when a wrong email is inserted. Thanks.
Please I need feedback on how to make the email return the error message when a wrong email is inserted. Thanks.
Using regular expressions is probably the best way
function validateEmail(email) {
const re = /^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
return re.test(String(email).toLowerCase());
}