Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System.Text.RegularExpressions;
- /// <summary>
- /// Determines whether source is a valid email address.
- /// </summary>
- /// <param name="source">The source</param>
- /// <returns>
- /// <c>true</c> if source is valid email address; otherwise, <c>false</c>.
- /// </returns>
- public static bool IsValidEmailAddress(this string source)
- {
- Regex regex = new Regex(@"^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$");
- return regex.IsMatch(source);
- }
Advertisement
Add Comment
Please, Sign In to add comment