Hi,
I am new to regular expressiona and have been trying to read html image tags from a file. The following test:
function sub_tag($string){
eregi('(<img[[:space:]]+[<>]+>)', $string, $result);
return $result;
}
$page = '<img src="images/dragon.gif"><img src="images/aerial.jpg" alt="Hanbury Self Catering Cottages set in peaceful Pembrokeshire countryside">';
$new_result = sub_tag($page);
echo count($new_result);
while(list($key, $value) = each($new_result)){
echo"<br />".$value;
}
is returning two results, but only the first tag for each value. I thought that eregi was supposed to store unique matches in an array. I am having real problems with this one as numerous solutions have failed, either only returning the entire string as one result or, as above only returning the same string twice.
Any help would be greatly appreciated!