Last active
August 29, 2015 13:56
-
-
Save rowej83/9203246 to your computer and use it in GitHub Desktop.
c# - returns true boolean if valid email address, not case sensitive
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
public bool checkIfEmail(string checkString){ | |
string regex=@"^(?("")(""[^""]+?""@)|(([0-9a-z]((\.(?!\.))|[-!#\$%&'\*\+/=\?\^`\{\}\|~\w])*)(?<=[0-9a-z])@))" + | |
@"(?(\[)(\[(\d{1,3}\.){3}\d{1,3}\])|(([0-9a-z][-\w]*[0-9a-z]*\.)+[a-z0-9]{2,24}))$"; | |
return Regex.IsMatch(checkString,regex,RegexOptions.IgnoreCase); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment