Unable to validate e-mail format
Posted
by
Aishwarya Shiva Pareek
on Stack Overflow
See other posts from Stack Overflow
or by Aishwarya Shiva Pareek
Published on 2012-04-15T11:26:27Z
Indexed on
2012/04/15
11:29 UTC
Read the original article
Hit count: 302
I am using this code which was suggested by my friend to validate an email id format in C#.
public bool IsValidEmail(string strIn)
{
string strPattern = "^([0-9a-zA-Z]([-.\\w]*[0-9a-zA-Z])*@([0-9a-zA-Z][-\\w]*[0-9a-zA-Z]\\.)+[a-zA-Z]{2,9})$";
if (System.Text.RegularExpressions.Regex.IsMatch(strIn, strPattern))
{ return true; }
return false;
}
When I pass the value of the strIn as
This function returns false. Please tell me whats wrong with it?
© Stack Overflow or respective owner