Someone earlier posted a question regarding extractin the image tags from an HTML file. I was working on a similar problem and managed to figure it out. Unlike many of the other responses to this question, this on e is very general and has been thouroughly tested.
The regexp is:
/(<[i|I][m|M][g|G]\s[>][s|S][r|R][c|C]\s?=\s?\"?)([>\s\"])([>]*>)/
The php code I use it with is:
preg_match_all("/(<[i|I][m|M][g|G]\s[>][s|S][r|R][c|C]\s?=\s?\"?)([>\s\"])([>]*>)/", $htmlcode, $matches);
echo "Image Tags matched:<br>\n";
foreach($matches[0] as $fullMatch) {
echo htmlentities($fullMatch)."<BR>\n";
}
echo "Image Paths extracted:<br>\n";
foreach ($matches[2] as $pathMatch) {
echo "$pathMatch<BR>\n";
}
hope this helps.