How to get first possible match using preg match in php -
i have 1 string
var str = 'abcd [[test search string]] text here ]]'; i have tried this
* preg_match("/\[\[test.*\]\]/i",$str,$match); if execute this, getting output below
[[test search string]] text here ]] i want first match
[[test search string]] is possible?
try way:
$str = "var str = 'abcd [[test search string]] text here ]]';"; preg_match("/(\[\[test[^]]*\]\])/im", $str, $match); print_r($match);
Comments
Post a Comment