62,268
社区成员
发帖
与我相关
我的任务
分享#region 客户端表单输入验证处理
/// <summary>
/// 判断是否为正确格式的电子邮箱
/// </summary>
/// <param name="Str">需要判断的电子邮箱</param>
/// <returns></returns>
public static bool IsEmail(string Str)
{
string strRegex = @"^[_\.0-9a-z-]+@([0-9a-z][0-9a-z-]+\.){1,4}[a-z]{2,3}$";
Regex re = new Regex(strRegex);
if (re.IsMatch(Str))
return true;
else
return false;
}
public static bool isEmail(string inputEmail)
{
inputEmail = NulltoString(inputEmail);
string strRegex = @"^([a-zA-Z0-9_\-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([a-zA-Z0-9\-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$";
Regex re = new Regex(strRegex);
if (re.IsMatch(inputEmail))
return (true);
else
return (false);
}