出于几个原因,我从一个脚本中获取输出,该脚本使用一些我不需要的额外 html 代码来爬取一个 html 页面。
这是我所拥有的:
... MY DATA IN A SINGLE ROW FOLLOWED BY ...> <script>function fbs_click() {u=location.href;t=document.title;window.open('http://www.facebook.com/sharer.php?u='+encodeURIComponent(u)+'&t='+encodeURIComponent(t),'sharer','toolbar=0,status=0,width=626,height=436');return false;}</script><style> html .fb_share_button { display: -moz-inline-block; display:inline; padding:1px 11px 0 5px; height:15px; border:1px solid #d8dfea; background:url(http://static.ak.facebook.com/images/share/facebook_share_icon.gif?6:26981) no-repeat top right; } html .fb_share_button:hover { color:#fff; border-color:#295582; background:#3b5998 url(http://static.ak.facebook.com/images/share/facebook_share_icon.gif?6:26981) no-repeat top right; text-decoration:none; } </style> <a rel="nofollow" href="http://www.facebook.com/share.php?u=/dizionario/recensi ne.asp?id=11334" class="fb_share_button" onclick="return fbs_click()" target="_blank" style="text-decoration:none;"></a>
也许这个额外的代码可以用一个 REGEXP 去除标签旁边的字符串的所有内容和包含的标签..