fork download
  1. <?php
  2. $string = "[img image:left]1.jpg[/img]Example Text 1[img image:left]2.jpg[/img] Example Text 2";
  3. $string = preg_replace("/\[img\s*[^\]]+\s*\](.*?)\[\/\s*img\]/i", ' \1 ', $string);
  4. echo $string;
Success #stdin #stdout 0.01s 20568KB
stdin
Standard input is empty
stdout
 1.jpg Example Text 1 2.jpg  Example Text 2