想要一个邮箱验证的 正则表达式 可以验证 [email protected]这种的.... 

解决方案 »

  1.   

    ^[\w-]+(\.[\w-]+)*@[\w-]+(\.[\w-]+)+$
    这很通用,如果非要net,可以把红色替换成net。
    不同的编程语言有不同使用正则方法,但差异不大。
    试试看。
      

  2.   

    sorry,上面我试过,有问题,换成这个试试
    ^[\w\-\.]+@[\w\-\.]+(\.\w+)+$
      

  3.   

    /^[a-zA-Z0-9_\-\.]+\@[a-zA-Z0-9_\-\.]+[.][a-zA-Z0-9_\-\.]+$/
      

  4.   


    var reg=/^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/;
    alert(reg.test("[email protected]"));
      

  5.   


    regex = "^\\w+((-\\w+)|(\\.\\w+))*\\@\\w+((\\.|-)\\w+)*\\.\\w+$";
      

  6.   

    <html>
    <head>
    </head>
    <body>
    <script>
    var str = ['[email protected]', '[email protected]', '[email protected]', 'test-123#163.com'], 
    reg = /^\w+(\-[A-Za-z0-9])*\w+\@\w+(\-[A-Za-z0-9])*\w+\.(?:net|cn|com)$/;
    for(var i in str){
    document.write(str[i]+": "+reg.test(str[i])+"<br/>");
    }
    </script>
    </body>
    </html>
      

  7.   

    上面有错误,修正下<html>
    <head>
    </head>
    <body>
    <script>
    var str = ['[email protected]', '[email protected]', '[email protected]', 'test-123#163.com'], 
    reg = /^\w+(\-[A-Za-z0-9]\w+)*\@\w+(\-[A-Za-z0-9]\w+)*\.(?:net|cn|com)$/;
    for(var i in str){
    document.write(str[i]+": "+reg.test(str[i])+"<br/>");
    }
    </script>
    </body>
    </html>
      

  8.   

    /^\+?[a-z0-9](([-+.]|[_]+)?[a-z0-9]+)*@([a-z0-9]+(\.|\-))+[a-z]{2,6}$/