c#里 我要判断输入到textbox里的是否为邮箱,即[email protected]形式
只用if() 做判断  ()里比较的表达式怎么写? 
要求能满足所有正确的邮箱格式

解决方案 »

  1.   

    正则表达式
    /^([a-zA-Z0-9]|[._])+@([a-zA-Z0-9_-])+(\.[a-zA-Z0-9_-])+/ 
      

  2.   

    /^[_\.a-z0-9A-Z]+@[a-z0-9A-Z]+[\.][a-z0-9A-Z]{2,}$/i
      

  3.   

    ^([a-z0-9A-Z]+[-|\.]?)+[a-z0-9A-Z]@([a-z0-9A-Z]+(-[a-z0-9A-Z]+)?\.)+[a-zA-Z]{2,}$
      

  4.   

    正则表达式 
    /^([a-zA-Z0-9]|[._])+@([a-zA-Z0-9_-])+(\.[a-zA-Z0-9_-])+/ !!
      

  5.   

    //标准的邮箱正则
    string emailPatten=@"^([a-z0-9A-Z]+[-|\.]?)+[a-z0-9A-Z]@([a-z0-9A-Z]+(-[a-z0-9A-Z]+)?\.)+[a-zA-Z](2,)$";//输入进去的邮箱地址
    string inputEmail;bool isMatch=Regex.IsMatch(inputEmail,emailPatten);
    if(isMatch)
    {
    //正确
    }else
    {
    //错误
    }
      

  6.   

    哈哈  原来MSDN里有呢