I am trying to troubleshoot and fix why my email validation is not properly working. It is suppose to detect an invalid email: where it had too many ...(dots), to still except European address (test@tom.uk.tk) as well as test@aol.com. But as of right now its excepting more that one dot, if you don't finish typing as long as it has the @ as long as you don't add the (.) dot. Will someone please help me with where I am going wrong?
<script>
$("#form").validate({
rules: {
firstname_1: {
required: true
},
email_1: {
required: true,
email: true
},
// Same for other fields
},
messages: {
firstname_1: "This field is required.",
email_1>: "Please enter valid email address.",
// Repeat for other fields
}
});
function isValidEmail(email_1)
{
return /^[a-z0-9]+([-._][a-z0-9]+)*@([a-z0-9]+(-[a-z0-9]+)*\.)+[a-z]{2,4}$/.test(email_1)
&& /^(?=.{1,64}@.{4,64}$)(?=.{6,100}$).*/.test(email_1);
}
</script>