【发布时间】:2011-02-22 10:58:07
【问题描述】:
<a class="rsswidget" href="http:/domain.com/feed/" title="RSS">
<img style="border:0" width="14" height="14" src="http://domain.com/images/rss.png" alt="RSS">
</a>
我需要什么正则表达式来摆脱整个锚点,包括里面的图像? 不幸的是,我是一个正则表达式菜鸟,所以我需要你的帮助。非常感谢。
return preg_replace('#<a+class="rsswidget"[^>]*>.*?</a>#is', '', $content);
【问题讨论】:
-
Replace UL tags with specific class 的可能副本 - 不要让标题欺骗了你。同样的问题,同样的解决方案。改变的只是论据。
标签: php regex preg-replace html-parsing