What do you get in place for image 2 ? (ie what does the regex return?)
Your code works for me with one exception...
$content = "<img width=588 height=381 src=\"35598-Science%20Coursework1_files/image001.gif\"> <img width=28 height=28 src=\"35598-Science%20Coursework1_files/image002.gif\"> <img width=28 height=28 src=\"35598-Science%20Coursework1_files/image003.jpg\">";
$image_path = "C:\docs";
$content =~ s|\Qsrc="\E(.*?)/(.*?)\"\>|src="$image_path/$2.$3">|sig;
print $content;
and I get...
<img ... /image003.jpg."> <-- note the extra period/dot here
The $3 isn't returning anything and the period "." doesn't seem to be function as intended.
Could there be another SRC="" in a tag that is causing it to break?
example: <javacript src="blah.js">
... just guessing ...
Your code works for me with one exception...
$content = "<img width=588 height=381 src=\"35598-Science%20Coursework1_files/image001.gif\"> <img width=28 height=28 src=\"35598-Science%20Coursework1_files/image002.gif\"> <img width=28 height=28 src=\"35598-Science%20Coursework1_files/image003.jpg\">";
$image_path = "C:\docs";
$content =~ s|\Qsrc="\E(.*?)/(.*?)\"\>|src="$image_path/$2.$3">|sig;
print $content;
and I get...
<img ... /image003.jpg."> <-- note the extra period/dot here
The $3 isn't returning anything and the period "." doesn't seem to be function as intended.
Could there be another SRC="" in a tag that is causing it to break?
example: <javacript src="blah.js">
... just guessing ...