email check using javascript

Posted by Klbaiju under JavaScript on 4/8/2012 | Points: 10 | Views : 1142 | Status : [Member] | Replies : 2
hi,
iam using this email validation

/^[\w\-\.\+]+\@[a-zA-Z0-9\.\-]+\.[a-zA-z0-9]{2,4}$/;
it allows 2 .com
ie
kl.baiju@yahoo.com is fine
but i want to avoid kl.baiju@yahoo.com.com
allows only one .com
how to solve this

Regards
Baiju




Responses

Posted by: Hariinakoti on: 4/9/2012 [Member] Starter | Points: 25

Up
0
Down
function validate(form_id,email) {

var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
var address = document.forms[form_id].elements[email].value;
if(reg.test(address) == false) {

alert('Invalid Email Address');
return false;
}
}

Try this code....

Thanks & Regards
Hari

Klbaiju, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Rajni.Shekhar on: 4/9/2012 [Member] Bronze | Points: 25

Up
0
Down

Login to post response