Hi All,
Please find the Code for Checking Valid Email from String
bool getValidationChecked = checkValidEmail(test@test.com);
public static bool checkValidEmail(string emailID)
{
bool validEmailAddress = false;
string[] arrayAdditionalTo = emailID.Split(';');
foreach (string word in arrayAdditionalTo)
{
string pattern = null;
pattern = "^([0-9a-zA-Z]([-\\.\\w]*[0-9a-zA-Z])*@([0-9a-zA-Z][-\\w]*[0-9a-zA-Z]\\.)+[a-zA-Z]{2,9})$";
if (Regex.IsMatch(word, pattern))
{
validEmailAddress = true;
}
else
{
return false;
}
}
if (validEmailAddress)
{
return true;
}
return false;
}
Please find the Code for Checking Valid Email from String
bool getValidationChecked = checkValidEmail(test@test.com);
public static bool checkValidEmail(string emailID)
{
bool validEmailAddress = false;
string[] arrayAdditionalTo = emailID.Split(';');
foreach (string word in arrayAdditionalTo)
{
string pattern = null;
pattern = "^([0-9a-zA-Z]([-\\.\\w]*[0-9a-zA-Z])*@([0-9a-zA-Z][-\\w]*[0-9a-zA-Z]\\.)+[a-zA-Z]{2,9})$";
if (Regex.IsMatch(word, pattern))
{
validEmailAddress = true;
}
else
{
return false;
}
}
if (validEmailAddress)
{
return true;
}
return false;
}
No comments:
Post a Comment