我正在尝试从 td 内的网页中过滤数据,它是这样的:
<td colspan="2">several anchor,bold and other html tags are inside this td</td>
我已经使用了这个 preg_match 但它给出了所有其他 td 的输出,但在上述情况下它没有给出任何输出。
preg_match("/\<td colspan\=\"2\"\>(.*)\<\/td\>/",$str,$title);
这是完整的td:
<td colspan="2">
<div align="left" style="width:370; height:315;">
<ins style="display:inline-table;border:none;height:280px;margin:0;padding:0;position:relative;visibility:visible;width:336px">
<ins style="display:block;border:none;height:280px;margin:0;padding:0;position:relative;visibility:visible;width:336px" id="aswift_1_anchor"><iframe width="336" scrolling="no" height="280" frameborder="0" style="left:0;position:absolute;top:0;" name="aswift_1" id="aswift_1" onload="var i=this.id,s=window.google_iframe_oncopy,H=s&&s.handlers,h=H&&H[i],w=this.contentWindow,d;try{d=w.document}catch(e){}if(h&&d&&(!d.body||!d.body.firstChild)){if(h.call){setTimeout(h,0)}else if(h.match){w.location.replace(h)}}" allowtransparency="true" hspace="0" vspace="0" marginheight="0" marginwidth="0"></iframe></ins></ins>
</div><p> When starting out sometimes it is a good idea to write down your <a href="#" style="text-decoration: underline !important;position:static;font-family:inherit !important;font-weight:inherit !important;font-size:inherit !important;" class="kLink" id="KonaLink1">
<font color="blue" style="color: blue !important; font-family:inherit !important;font-weight:inherit !important;font-size:inherit !important;position:static;"> <span style="color: blue !impor If you seriously want to take back control of your money you need to build a <a href="http://ezinearticles.com/?To-Set-Up-a-Personal-Budget-Get-a-Pencil-and-Paper&id=1629478">Personal Budget</a>. To learn more about creating a budget please visit the website <a href="http://household-budget.home-choices-net.com">Household Budgets by clicking here</a>. </p><p> </p><p><!-- google_ad_section_end -->
</p><p>
<font style="color:02679D; font-size:12"><b><font color="000000">Related Articles -
</font>
</b></font>
</p><p><table width="100%" border="0"><tbody><tr>
<td align="center">
<br><br><br><br>
<br><br>
</font></p></td></tr></tbody></table>
</p></td>