Validate Email format
April 14, 2009
Feedback's a good way to encourage author even if it's a criticize. It's proved you care about the article. Please, leave a comment to let everyone know what you think about this post.
Check the input string if it’s in correct email format or not.
using System.Text.RegularExpressions;
public static bool isEmailAddress(string emailAddress)
{
string patternStrict = @"^(([^<>()[].,;:s@""]+"
+ @"(.[^<>()[].,;:s@""]+)*)|("".+""))@"
+ @"(([[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}"
+ @".[0-9]{1,3}])|(([a-zA-Z-0-9]+.)+"
+ @"[a-zA-Z]{2,}))$";
Regex reStrict = new Regex(patternStrict);
bool isStrictMatch = reStrict.IsMatch(emailAddress);
return isStrictMatch;
}

Leave a Reply