function isEmail(strEmail) {
if (strEmail.search(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/) != -1) {
return true;
}
return false;
}
跟mvc3 的@字符发生冲突
改为:@{@Html.Raw("@");}
即:
function isEmail(strEmail) { if (strEmail.search(/^\w+((-\w+)|(\.\w+))*\@{@Html.Raw("@");}[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/) != -1) { return true; } return false; }
原文链接:https://www.f2er.com/regex/362490.html