Answers for "regex to validate mail in js"

46

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
1

js email regex

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());
}
Posted by: Guest on January-06-2021
0

regular expresion for email javascript

// onclick function
function validEmail() {
    const regularExpresionForEmail = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/;
    const input = document.getElementById('input')
    const inputValue = input.value;

    if (inputValue.match(regularExpresionForEmail)) {
        const successmsg = document.getElementById('text');
        successmsg.innerHTML = `<p class="text-success">Your Input is Valid</p>`

    } else {
        const msg = document.getElementById('text');
        msg.innerHTML = `<p class="text-danger">Input  Valid charecter! </p>`

    }
    input.value = '';
}
Posted by: Guest on September-08-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language