Validation to Check for Comma separated EmailIDs
Regular Exp Description:
List of Email ids separated with [,] Email ID may contain character set as [._-']Regular Expression
^((\w+([-_.']\w+)*@\w+([-_.']\w+)*\.\w+([-_.']\w+)*)*([,])*)*$ Regular expression Rules:
Finite automata rule Values should proceed with email Ids with Comma Separated. No comma will precede the email IDs.Matches:
abc.xyz@anonymous.com
abc.xyz@anonymous.com,abc-xyz@anonymous.com,abc_xyz@anonymous.com
abc.xyz@anonymous.com,com,D'Souza@anonymous.com Non-Matches:
abc.xyz
,abc.xyz@anonymous.com
abc.xyz@anonymous.com,
abcJavascript:
function CheckForCommaSeperatedEmailIDs( fieldValue )
{
var regex = /^((\w+([-_.']\w+)*@\w+([-_.]\w+)*\.\w+([-_.]\w+)*)*([,])*)*$/;
if( !fieldValue.match( regex ) )
{
alert('The Email IDs Invalid');
return false;
}
return true;
}
Excellent tutorial