例如,<a href="http://msdn.microsoft.com/art029nr/">remove links to here but keep text</a> but <a href="http://herpyderp.com">leave all other links alone</a>
PHP删除链接到特定的网站,但保留文本
我一直在试图解决这个使用的preg_replace。我在这里搜索并找到解决问题的答案。
PHP: Remove all hyperlinks of specific domain from text的答案删除指向特定网址的链接,但也删除文本。
http://php-opensource-help.blogspot.ie/2010/10/how-to-remove-hyperlink-from-string.html的网站从字符串中删除超链接,但我似乎无法修改该模式,因此它只适用于特定的网站。
[不要使用正则表达式解析HTML](http://stackoverflow.com/a/1732454/344643)使用[XML解析器](http://us2.php.net/manual/en/class。 domdocument.php)代替。 – 2013-02-11 00:13:02