Hi,
I have a simular problem (which might be the same as PaPPy's ? )
I have some HTML which my script is converting to BBCode.
The page recieving the HTML and converting it shall recieve an unlimited, yet unknown, number of image tags ending with:
" alt="" width="xxx" height="xxx" />
The xxx shall be replaced by an unknown number.
If I run:
$message = preg_replace("/\" alt(.*)\/>/", "END_OF_IMAGE", $message, 1);
this works fine for the first image, but if there are multiple images it uses the first alt tag and last />. This means that it does not work with multiple images. Does anyone know a way around this? Maybe I need to somehow do a count of the number of tags starting with <img and use that number as the limit. Would that work?
BTW I then later on replace the ENG_OF_IMAGE with [/img] in the main str_replace
Hope someone can help 🙂