最近发了个帖子,好多朋友留下了邮箱,我现在需要把一个文件发给这些邮箱。
我从帖子里复制了所有文本,但不知道怎么才能把里面的邮箱筛选出来。
高手给个代码啊。

解决方案 »

  1.   

    类似这样的[email protected] [email protected] ,谢谢了! 
    你好楼主    [email protected]    希望能得到您的图集![email protected] [email protected] [email protected] [email protected]    谢谢   呵呵相当需要[email protected] [email protected] 
      

  2.   


    <div id="test">
    [email protected] [email protected] ,谢谢了!  
    你好楼主  [email protected] 希望能得到您的图集![email protected] [email protected] [email protected] [email protected] 谢谢 呵呵相当需要[email protected] [email protected] 
    </div>
    <script>
    function $(o){return document.getElementById(o)}
    var str = $('test').innerHTML;
    var re = /\[email protected]/gi;
    alert(str.match(re))
    </script>全是qq的邮箱? 开头是 数字,,,取个巧。
      

  3.   

    var re = /\d+@qq\.com/gi;
      

  4.   


    var str = "[email protected] [email protected] ,谢谢了! 你好楼主  [email protected] 希望能得到您的图集![email protected]  [email protected] [email protected] [email protected] 谢谢 呵呵相当需要[email protected] [email protected] ";
    alert(str.match(/([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+(\.[a-zA-Z0-9_-]+)/g));楼主这样可以吗?