62,074
社区成员
发帖
与我相关
我的任务
分享
private bool verEmail(string email)
{
bool b = false;
string regexEmail = "\\w+([-+.']\\w+)*@\\w+([-.]\\w+)*\\.\\w+([-.]\\w+)*";
string regEx = "[`~!#$%^&*()+=|{}':;',\\[\\]<>/?~!#¥%……&*()+|{}【】‘;:”“’。,、?]";
if (email.IndexOf("@") != email.LastIndexOf("@"))
return false;
System.Text.RegularExpressions.RegexOptions options = ((System.Text.RegularExpressions.RegexOptions.IgnorePatternWhitespace
| System.Text.RegularExpressions.RegexOptions.Multiline)
| System.Text.RegularExpressions.RegexOptions.IgnoreCase);
System.Text.RegularExpressions.Regex regEmail = new System.Text.RegularExpressions.Regex(regexEmail, options);
System.Text.RegularExpressions.Regex regEx2 = new System.Text.RegularExpressions.Regex(regEx, options);
if (regEmail.IsMatch(email))
b = true;
if (regEx2.IsMatch(email))
b = false;
return b;
}