static boolean THK_validateEmail(args _arg)
{
str _email = "jimmy.xie@tectura.com;jimmyxie.yf@hotmail.com";
str emailRegex = @"^([\w-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([\w-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$";
str email;
List emailAddresses;
ListEnumerator enum;
System.Text.RegularExpressions.Regex regEx;
System.Text.RegularExpressions.Match regMatch;
InteropPermission permission = new InteropPermission(InteropKind::ClrInterop);
boolean retVal;
permission.assert();
//BP Deviation documented
regEx = new System.Text.RegularExpressions.Regex(emailRegex);
// Split the email address string and validate each email address
emailAddresses = SysEmailDistributor::splitEmail(_email);
enum = emailAddresses.getEnumerator();
while(enum.moveNext())
{
email = enum.current();
if (email)
{
regMatch = regEx.Match(email);
retVal = regMatch.get_Success();
}
else
retVal = false;
// If a single email address is invalid, the string is invalid
if(!retVal)
break;
}
info(queryValue(retVal));
return retVal;
}
没有评论:
发表评论