11/25/2013 1:48:46 AM

The following uses regular expressions to determine if a given string is a valid email address.

using System.Text.RegularExpressions; .... public static bool IsValidEmail(string email) { if (string.IsNullOrEmpty(email)) { return false; } Regex regex = new Regex(@"\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*", RegexOptions.Compiled); Match match = regex.Match(email); return ((match.Success && (match.Index == 0)) && (match.Length == email.Length)); }