And just incase here is some surrounding code
Code:
if ($phpversionnum<"4.0.5") {
$bbcode=str_replace("'", "\'", $bbcode);
}
$bbcode=preg_replace($searcharray, $replacearray, $bbcode);
if($dobbimagecode and ($bbuserinfo[userid]==0 or $bbuserinfo[showimages])) {
// do
$bbcode = preg_replace("/\[img\](\r\n|\r|\n)*((http|https):\/\/([^;<>\(\)\"".iif($allowdynimg,"","!\*\?\&")."]+)|[a-z0-9\/\\\._\- ]+)\[\/img\]/siU", "<img src=\"\\2\" border=\"0\" alt=\"\">", $bbcode);
}
$bbcode = preg_replace("/\[img\](\r\n|\r|\n)*((http|https):\/\/([^;<>\*\(\)\"]+)|[a-z0-9\/\\\._\- ]+)\[\/img\]/siU", "<a href=\"\\2\" target=\"_blank\">\\2</a>", $bbcode);
$bbcode=str_replace("\\'", "'", $bbcode);