Home >Backend Development >PHP Tutorial > 请问正则过滤UBB代码

请问正则过滤UBB代码

WBOY
WBOYOriginal
2016-06-13 12:59:25904browse

请教正则过滤UBB代码~

[link url="http://jjckb.xinhuanet.com/2012-11/29/content_415369.htm"]大连富豪富彦斌失踪9个月[/link]

改成 大连富豪富彦斌失踪9个月
------解决方案--------------------
$s='[link url="http://jjckb.xinhuanet.com/2012-11/29/content_415369.htm"]大连富豪富彦斌失踪9个月[/link]';
echo preg_replace('/\[link url="([^\"]+)"\]([^\[]+)\[\/link\]/','$2',$s);

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn