validate emails which is seperated with comma
ASP.NET
3
Posts
3
Posters
0
Views
1
Watching
-
how can i validate emails which is seperated with comma(,) using javascript. plz help me to grt the code thks yesuprakash
Hey, Please visit the following links. http://regexlib.com/DisplayPatterns.aspx http://www.regular-expressions.info/ I hope u will get your answer there.
Mehedi Hasan
-
how can i validate emails which is seperated with comma(,) using javascript. plz help me to grt the code thks yesuprakash
Heres a function I use:
function ValidateMultiEmail(value) { var emails = value.split(','); var re = new RegExp("\\w+([-+.']\\w+)*@\\w+([-.]\\w+)*\\.\\w+([-.]\\w+)*"); var valid = true; for (var i = 0; i < emails.length; i++) { if (emails[i].trim() != '' && !re.test(emails[i])) { valid = false; break; } } return valid; }
The regular expression isn't full-proof - you will get some false positives but only in the most unlikely cases.