JS Function Validating Email for IE and Edge

1

I have a JS code that validates email perfectly and is in use on the portal. No then this function does not work in the IE browser and / or Edge.

function validaEmail(email) {
    var regex = /^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i;
    return regex.test(email);
}

function validaEmail(email) {
    var regex = /^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i;
    return regex.test(email);
}

console.log(validaEmail("Danielle.com"));
console.log(validaEmail("[email protected]"));
    
asked by anonymous 05.06.2018 / 20:47

0 answers