c#怎样判断email格式输入正确??

来源:百度知道 编辑:UC知道 时间:2024/07/06 15:21:04
c#怎样判断email格式输入正确??
下面的代码怎么用啊 ,放在哪里 用?

用正则表达式:
bool IsValidEmail(string strIn)
{
// Return true if strIn is in valid e-mail format.
return Regex.IsMatch(strIn, @"^([\w-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([\w-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$");
}

来晚了,LS回答的很对

来晚了,LS回答的很对

来晚了,LS回答的很对

在VS中有个检验控件中,有个属性是可以选择检验邮箱之类的!