I have a image tag e.g. <img src="../news/190/mlmeg.html" class="blkthin"> and I want to replace this with the image file name I have just uploaded i.e. <img src="foo.jpg" class="blkthin">
I read the above html file into a the $contents variable.
I use preg_replace function in the file upload script using the uploaded file name variable i.e.
$search = array(
"/<img src=(http(s?):\/\/)?(www\.)?([\w\.]+)\{$userfile_name}/is"
);
$replace = array("<img src=\"$userfile_name\" alt=\"$1");
$contents = preg_replace($search, $replace, $contents);
Could someone point out where the problem is in my regex evaluation.
Regards
Synfield