/**
* verifie si la chaine renseigné est un email
* check if email is valide
* @paramstring emailAdress
* @return bool
*/functionisEmail(emailAdress){let regex =/^w+([.-]?w+)*@w+([.-]?w+)*(.w{2,3})+$/;if(emailAdress.match(regex))returntrue;elsereturnfalse;}//see https://regexr.com/3e48o for another exemple
//! check email is validfunctioncheckEmail(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,}))$/;if(re.test(email.value.trim())){console.log('email is valid')}else{console.log('email is not valid')}}
functionvalidateEmail($email){var emailReg =/^([w-.]+@([w-]+.)+[w-]{2,4})?$/;return emailReg.test( $email );}if(!validateEmail(emailaddress)){/* do stuff here */}
check email id valid or not without using regex in javascript
functionValidateEmailAddress(emailString){// check for @ signvar atSymbol = emailString.indexOf("@");if(atSymbol <1)returnfalse;var dot = emailString.indexOf(".");if(dot <= atSymbol +2)returnfalse;// check that the dot is not at the endif(dot === emailString.length-1)returnfalse;returntrue;}