Fixed handling of multiple images on the same line

The script was failing when multiple images were defined in the same
line, due to the greedy matching in the image extraction regexp. That
regexp has been fixed to avoid this happening.