Hey all -
I'm trying to prepend a path to all the images specified in the content of an uploaded HTML file. So:
<img src='image.gif'>
would become:
<img src='/rootPath/image.gif'>
I'm using preg_replace() (I've got some additional constraints). I'm pretty sure I've got the regular expression right, since it works most of the time. But in certain instances, mainly when the HTML code has a few images with no other code or newlines in between, the last one might not be matched. So:
<img src='image.gif'>
<img src='image.gif'>
<img src='image.gif'>
would be fine, but if there's:
<img src='image.gif'><img src='image.gif'><img src='image.gif'>
only the first two might be matched. Why the heck would that be happening?? The matching string would seem to be correct, and since the first two matched, it can obviously match one after the other...so why not the third? Matches beyond that point in the code may have been replaced, too, so it's not like the engine just gives up at a certain point -- something cause it to miss particular matches.
Thanks for any help,
Jeremy