Answers for "check if a string is an email in javascript"

50

javascript regex email

function validateEmail (emailAdress)
{
  let regexEmail = /^w+([.-]?w+)*@w+([.-]?w+)*(.w{2,3})+$/;
  if (emailAdress.match(regexEmail)) {
    return true; 
  } else {
    return false; 
  }
}

let emailAdress = "[email protected]";
console.log(validateEmail(emailAdress));
Posted by: Guest on March-26-2020
5

how to validate an email address in javascript

function validateEmail(email) 
    {
        var re = /S+@S+.S+/;
        return re.test(email);
    }
    
console.log(validateEmail('[email protected]'));
Posted by: Guest on June-18-2020

Code answers related to "check if a string is an email in javascript"

Code answers related to "Javascript"

Browse Popular Code Answers by Language