language: PHP (php 5.4.4)
date: 388 days 3 hours ago
link:
visibility: public
1
2
3
4
5
6
7
8
9
<?php
$str = " 
Line 1: This is a string 
Line 2: [img] image_path [/img] Should not be [img] image_path2 [/img] included. 
Line 3: End of test [img] image_path3 [/img] string."; 
 
preg_match_all("~\[img](.+?)\[/img]~i", $str, $m); 
 
var_dump($m[1]);