I have this
[caption]<img />[/caption]
I have removed the caption tags usign this
$content = preg_replace("/\[.*?\]/", "", $content);
However, I want to replace it with div like this
<div><img></div>
What I am missing? Any help is appreciated.
I have this
[caption]<img />[/caption]
I have removed the caption tags usign this
$content = preg_replace("/\[.*?\]/", "", $content);
However, I want to replace it with div like this
<div><img></div>
What I am missing? Any help is appreciated.
you could try like:
$search_for = '/\[caption\](.*?)\[\/caption\]/is';
$replace_with = '<div>$1</div>';
$str = "[caption]<img />[/caption]";
$replaced = preg_replace($search_for, $replace_with, $str);
echo $replaced;