fork(2) download
  1. <?php
  2. $str = "
  3. Line 1: This is a string
  4. Line 2: [img] image_path [/img] Should not be [img] image_path2 [/img] included.
  5. Line 3: End of test [img] image_path3 [/img] string.";
  6.  
  7. preg_match_all("~\[img](.+?)\[/img]~i", $str, $m);
  8.  
  9. var_dump($m[1]);
Success #stdin #stdout 0.02s 13112KB
stdin
Standard input is empty
stdout
array(3) {
  [0]=>
  string(12) " image_path "
  [1]=>
  string(13) " image_path2 "
  [2]=>
  string(13) " image_path3 "
}