Just use str_replace()
?
$string = "PrivateImg-0123456789.jpg";
echo str_replace(".jpg", "[whateveryouwant].jpg", $string);
If you must use regex:
$string = "PrivateImg-0123456789.jpg";
echo preg_replace("/\.(jpe?g|png|gif)$/si", "[whateveryouwant].$1", $string);
This will do jpg, jpeg, png and gif, as long as it is the last part. /foo/bar.gif/thisIsWeird
wont match