2012-04-06 50 views
1

我有一個這樣的字符串:如何使用正則表達式在php中替換組?

[img]http://placehold.it/350x150[/img] [img]http://placehold.it/350x250[/img] 

我想抓住實際的鏈接,並將其放置在IMG

<img src="http://placehold.it/350x150" /> <img src="http://placehold.it/350x250" /> 

我大概可以創建一組這樣的:[img](.*)[/img]但我不是確定如何在php中替換它。

形式另一個角度來看我太冷漠做一個簡單的字符串替換幾次更換

[img] with <img src=" and [/img] with " /> 

林不知道,女巫一個是更好的選擇

IM也試圖做德同變薄了[video]http://www.youtube.com/watch/?v=lzBxqBsEIlE[/video]

有什麼想法嗎?

感謝

+2

試過Google嗎? http://www.google.de/search?q=php+bbcode – KingCrunch 2012-04-06 20:13:19

回答