{
string email = broker.EmailId.Trim();
string emailExpression = @"^[a-z][a-z|0-9|]*([_][a-z|0-9]+)*([.][a-z|" + @"0-9]+([_][a-z|0-9]+)*)?@[a-z][a-z|0-9|]*([-][a-z|0-9]+)*\.([a-z]" + @"[a-z|0-9]*(\.[a-z][a-z|0-9]*)?)$";
//broker.Messages = new List
Regex regExpEmail = new Regex(emailExpression, RegexOptions.IgnoreCase);
if(string.IsNullOrEmpty(broker.EmailId))
{
broker.Messages.Add("Email id is mandatory");
}
else if(!regExpEmail.IsMatch(email))
{
broker.Messages.Add(string.Format(Helper.InvalidID,"Email id"));
}
return !regExpEmail.IsMatch(email);
}
No comments:
Post a Comment