fork(1) download
  1. <?php
  2.  
  3. $reg = '/=["\']img\/([^"\']*)["\']/';
  4. $src = ['="img/image-file1.jpg"', '="img/file-2.png"', '="img/image3.jpg"'];
  5.  
  6. foreach ($src as $s) {
  7. $str = preg_replace($reg, '={{media url="wysiwyg/$1"}}', $s);
  8. echo "$str\n";
  9. }
Success #stdin #stdout 0.02s 23776KB
stdin
Standard input is empty
stdout
={{media url="wysiwyg/image-file1.jpg"}}
={{media url="wysiwyg/file-2.png"}}
={{media url="wysiwyg/image3.jpg"}}