"Just use a regex" is the most common wrong answer to email validation. Here's what actually matters, in the order it actually matters.

1. Syntax — but a permissive one. The RFC 5322 spec technically allows things like quoted strings and comments in the local part, which almost no real mail provider uses. Don't implement the full spec; use a pragmatic check instead:

function looksLikeEmail(input) {

return /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(input);

}