哪位有 email格式验证 的代码?急需!
谢谢!

解决方案 »

  1.   

    public static bool IsValidEmail( String strValid )
    {
    Regex rCode = new Regex(@"^\w+((-\w+)|(\.\w+))*\@\w+((\.|-)\w+)*\.\w+$");
    if(!rCode.IsMatch(strValid))
    {
    return false;
    }
    else
    {
    return true;
    }
    }
      

  2.   

    正则表达式:\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*
      

  3.   

    public static bool IsEmail(string strEmail)
    {
    if(!Regex.IsMatch(strEmail.Trim(),"\\w+([-+.]\\w+)*@\\w+([-.]\\w+)*\\.\\w+([-.]\\w+)*"))
    {
    return false;
    }
    return true;
    }