var str = "发撒旦发生[email protected] 发大水放大[email protected] fdf [email protected]";
str = str.replace( /@yaoo\.com/gi,"@sina.com";

解决方案 »

  1.   

    <script>
    var str ='发撒旦发生[email protected] 发大水放大[email protected] fdf [email protected]';
    var reg = /@\S+/g;
    alert(str.replace(reg,'@hansir.cn'));
    </script>
      

  2.   


    var str = "发撒旦发生[email protected] 发大水放大[email protected] fdf [email protected]"; 
    str = str.replace( /@yaoo\.com/gi,"@sina.com");//刚才少了个),是替换yaoo还是yahoo啊?
      

  3.   

    <script>
        var str ='发撒旦发生[email protected] 发大水放大[email protected] fdf [email protected]';
        var reg = /@sina.com|@yaoo.com|yahoo.com/g;
    str=str.replace(reg,'@chinmo.net')
        alert(str);
    </script>