Well, I'd suggest you do not want to do what your question's title asks for (and what Abigail has already told you). You already can see it in your first attempts on solving your problem: you won't match img elements that have an attribute different from src in the beginning. You will miss elements, that have 'display:block' in their title-attribute. You will somehow produce duble style-attributes inmany cases...
The solution is to use HTML::Parser or HTML::Tokeparser to fastly run through the text and extract img elements and explicitly check the style attribute for the display-property and add it if not present. That may be a bit slower in the end, but it will get all cases and produce good results.
--
http://
fruiture.de