We have .js email validation function using regex for a textbox. But however our validation allows wrong emails, when user mentions email ID, starting with comma or period symbol. Please help with the code.
function validEmailAddress(emailAddress){   
    var regex = /^([\w-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([\w-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$/;
    var result = emailAddress.replace(/\s/g, "").split(/,|;/); 
    alert(result.length);       
    for(var i = 0;i < result.length;i++) {
        if(!regex.test(result[i])) {
            return false;
        }
    }       
    return true;
}
 
    