email validation

can somebody please help me to validate the email perfectly step by step

let email = "{last_utterance}"; // replace with the variable that holds the user's input
let emailRegex = /^[^\s@]+@[^\s@]+.[^\s@]+$/;

if (emailRegex.test(email)) {
// The email is valid
} else {
// The email is not valid
} it is always going to valid stage irrespective of adding invalid state
Screenshot_2024-05-14_160033.png
Was this page helpful?