<script type="text/javascript">
var ps = "[A-Za-z]\\w{3,}@\\w{2,}(\\.\\w{2,})+"
var p = new RegExp("^" + ps + "(;" + ps + ")*$")
var s = "[email protected]";
alert(p.test(s));
</script>

解决方案 »

  1.   

    <script type="text/javascript">
    var ps = "[A-Za-z]\\w{3,}@\\w{2,}(\\.\\w{2,})+";
    var p = new RegExp("^" + ps + "(;" + ps + ")*$");
    var s = "[email protected]"; //[email protected];[email protected]...
    var boolean = p.test(s);
    alert(boolean);
    </script>
      

  2.   

    嗯!你那个只能检测单个email的呀.
    我是想批量检测,所以要用到split分割成数组,然后要循环遍历一次.
      

  3.   

    /^\w+((-\w+)|(\.\w+))*\@\w+((\.|-)\w+)*\.\w+$/
      

  4.   

    <script type="text/javascript">
    function checkEmail(s) {
    var ps = "[A-Za-z]\\w{3,}@\\w{2,}(\\.\\w{2,})+";
    var p = new RegExp("^" + ps + "(;" + ps + ")*$");
    if (p.test(s)) {
    var t = new RegExp("(" + ps + ");?", "g");
    var temp = ";";
    s = s.replace(t, function (a, b) {
    if (temp.indexOf(";" + b + ";") == -1) {
    temp += b + ";";
    return b + ";";
    } else return "";
    });
    return s.substring(0, s.length - 1);
    } else return false;
    }
    var s = "[email protected];[email protected];[email protected];[email protected];[email protected]";
    if (s = checkEmail(s)) alert(s);
    else alert("箱子错误");
    </script>
    这个可以替换掉重复的箱子。
      

  5.   

    大家继续发言呀..
    muxrwc(王辰),li1229363() ,fqcd555(Oo等待你oO)建议都不错..谢谢了