just the the images
$content="}
}
hello world
}
}"
$text='}\s*[
]*\s*[
]*\s*}';
$ss="~$text(?!.*$text)~";
$res=preg_replace($ss,'replacement',content);
echo $res;//$res:"replacement hello world replacement"
I want replace only the last '} }'using preg_replace()