2016-04-12 28 views
0

删除[字幕] [/字幕]假设我有串上午串

test [caption id="attachment_13399" align="alignleft" width="240"]<img class="img" src="test.jpg" alt="Test Image" width="240" height="270" /> Test remove capture[/caption] end test 

我的preg_replace后只需要显示:test end test

,但我得到test Test remove capture end test

我的正则表达式是:$text = preg_replace('/\[.*?\]/', '', $a_record['content'])

你能帮助我吗? THX提前对不起我的英语

回答

1

将其更改为:

/\\[caption.*?\\].*\\[.caption\\]/ 

这将删除一切的[caption]之间[/caption]

相关问题