本帖最后由 BillyW 于 2010-04-07 11:25:01 编辑

解决方案 »

  1.   

    var text = "1234:1234-2222@你好啊,1234:1234-2222@我很好,1234:1234-2222@去你的,1234:1234-2222@ 哈哈";
    text = text.replace(/(^|,).*?@\s*/g, ",");
    text = text.replace(/^,+|,+$/, "");
    alert(text);
      

  2.   


    alert(str.match(/@[^,]*/g))
      

  3.   

    <script>
    window.onload=function(){
    var str = "1234:1234-2222@你好啊,1234:1234-2222@我很好,1234:1234-2222@去你的,1234:1234-2222@哈哈";
    alert(str.match(/[^@]+?(,|$)/g).join(""));
    }
    </script>
      

  4.   

    match(/[^@]+?(,|$)/g)//得到["你好啊,","我很好,","去你的,","哈哈"]
    join("")//容易理解