正则表达式验证邮件格式
·
public override void Checked()
{
string vInputName = this.SqlCheck.ExecutePara.InputName;
string vValue = ObjectHelper.GetString(this.Value, vInputName);
string regEmail = @"\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*";
if (!Regex.IsMatch(vValue.Trim(), regEmail))
{
string vFormat = this.SqlCheck.Format;
string vTitle = this.GetTitle();
if (string.IsNullOrEmpty(vFormat))
{
vFormat = "[{0}]的邮箱格式错误!";
}
}
}
{
string vInputName = this.SqlCheck.ExecutePara.InputName;
string vValue = ObjectHelper.GetString(this.Value, vInputName);
string regEmail = @"\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*";
if (!Regex.IsMatch(vValue.Trim(), regEmail))
{
string vFormat = this.SqlCheck.Format;
string vTitle = this.GetTitle();
if (string.IsNullOrEmpty(vFormat))
{
vFormat = "[{0}]的邮箱格式错误!";
}
}
}
更多推荐
所有评论(0)