我有一些文字,如下面的例子:刪除文本使用的preg_replace
Some Text Here
[code]Some link[/code]
Text
[code]Link[/code]
Other Text
[code]Another Link[/code]
Other Text1
我想刪除上面的所有文字,下,和兩個代碼之間。下面是輸出的一個例子,我想:
[code]Some Link[/code]
[code]Link[/code]
[code]Another Link[/code]
我用preg_replace
第一個以上代碼刪除文本,以這樣的方式
$message = preg_replace('/(.*?)\[code/si','[code',$message, 1);
你能不能幫我刪除其他文字,使用preg_replace
?
您是否嘗試過使用'preg_split'? –
preg_split的用法是什麼? – user1825932