-
-
Save kirillrybin/7369079 to your computer and use it in GitHub Desktop.
Unity dotNet IsValidEmail
via http://nishantwork.wordpress.com/2012/10/11/how-to-validate-email-address-in-net-by-c/
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// <summary> | |
/// Validate Email Address | |
/// </summary> | |
/// <param name="email"></param> | |
/// <returns></returns> | |
private static bool IsValidEmail(string email) | |
{ | |
var r = new Regex(@"^([0-9a-zA-Z]([-\.\w]*[0-9a-zA-Z])*@([0-9a-zA-Z][-\w]*[0-9a-zA-Z]\.)+[a-zA-Z]{2,9})$"); | |
return !string.IsNullOrEmpty(email) && r.IsMatch(email); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment