如何用正则表达式判断邮箱的格式呢?

谢谢!
if(document.getElementById("Email").value=="")
{
alert("请输入您的电子邮件!");
return false;
}
<asp:TextBox runat="server" ID="Email"></asp:TextBox>

string sqlInsert = "insert into UserInfo (Name,Sex,Email,tel,Pwd)";
sqlInsert += "values(@Name,@Sex,@Email,@Tel,@Pwd)";
该如何实现呢?
最新回答
禁区

2024-06-08 03:27:06

function CheckEmail(email)
{
var reg = new Regex("(?:[a-z\d]+[_\-\+\.]?)*[a-z\d]+@(?:([a-z\d]+\-?)*[a-z\d]+\.)+([a-z]{2,})+","ig");
return reg.test(email);
}
孤岛re∷

2024-06-08 00:10:07

email.matches("\\w+@\\w+[.]((com)|(net))")