请帮忙做的preg_replace正则表达式来改变html标记为 “BB”如何preg_replace html标签?
<img src="URL" style="max-width: 780px;"/>
<div id="center">TEXT</div>
<a href="http://href.li/?URL" target="blank">$1</a>
<iframe width="780" height="450" src="//www.youtube.com/embed/TEXT" frameborder="0" allowfullscreen></iframe>
<strong>TEXT</strong>
[img]$1[/img]
[center]$1[/center]
[link]$1[/link]
[video]$1[/video]
[strong]$1[/strong]
确定。我做到了
%<img src=\"*(.*?)\".*>%
[你不能用正则表达式解析HTML](http://stackoverflow.com/a/1732454/156811) – Havenard 2014-08-31 17:48:19
我从mysql中得到像text/plain这样的字符串。 preg_replace('/
/i','\ n',$ row ['description']); 它的工作原理。也许我问了这个问题。 – 2014-08-31 18:27:41