\s 匹配任何空白字符,包括空格、制表符、换页符等等。等价于 [ \f\n\r\t\v]。

解决方案 »

  1.   

    re=/^[a-zA-Z][a-zA-Z0-9\.\_\-\s]*@([a-zA-Z0-9-_]+\.)+(com|gov|net|com\.cn|edu\.cn)$/;
      

  2.   

    我这么做了
       /^[a-zA-Z][a-zA-Z0-9._ -]*@([a-zA-Z0-9-_]+\.)+(com|gov|net|com\.cn|edu\.cn)$/
       /^[a-zA-Z][a-zA-Z0-9._\s-]*@([a-zA-Z0-9-_]+\.)+(com|gov|net|com\.cn|edu\.cn)$/提示如下错误
       字符集越界
      

  3.   

    hbhbhbhbhb1021(天外水火(我要多努力)) 的方法认为 effort [email protected]  是不合法的格式
      

  4.   

    不会是不合法的,不过感觉这个正则写得不是太好
    <script language=javascript>
    re=/^[a-zA-Z][a-zA-Z0-9\.\_\-\s]*@([a-zA-Z0-9-_]+\.)+(com|gov|net|com\.cn|edu\.cn)$/;
    alert(re.test("effort [email protected]"))
    </script>
      

  5.   

    <SCRIPT LANGUAGE="JavaScript">
    function check()
    {
    var s ="effort [email protected]";
    var re=/\w+\@\w+[[\.\w+]|[\.\w+\.\w+]]$/;
    alert(re.test(s));
    }
    </SCRIPT>