Posted by John Dunlop on 01/11/06 22:25
Nel wrote:
> <?PHP
> $htmlsource = '<img src="pics/hotdog.gif"> text text <img
> src="pics/silly%20sausage.gif"> ';
> eregi('(=")(pics/)([0-9a-zA-Z%/ ]+.[a-zA-z]..)(")',$htmlsource,$imagesintext);
> ?>
[...]
> What I am trying to do is replace all images in the format ="pics/image.jpg"
> with "image.jpg" and at the same time make a list of the files image.jpg.
> The problem is how to pick up ALL the occurances, not just the first???
preg_match_all(). preg_match is described as an alternative to ereg()
and it stops searching after finding one match, so I assume ereg()
stops then too.
http://www.php.net/manual/en/function.preg-match-all.php
> Also how to use replace to remove the pics/ bit of the string.
Replace them with the zero string. preg_replace().
http://www.php.net/manual/en/function.preg-replace.php
--
Jock
[Back to original message]
|