Solution
Since you are using Java, here is a simple example for matching img tags without a width or height attribute. I used the Jsoup html parser:
Document doc = Jsoup.parse(myHtmlCode).get();
Elements imgsWithoutHeighOrWidth = doc.select("img:not(img[height], img[width])");
Demo
http://try.jsoup.org/~z1zP_fkmQPOi4Nbj87omMgbDbr0
Explanation
The big part here is the cssQuery passed to the select method.
I asked it to find:
img => any img tags
:not( => not in
img[height] => any img tags with an `height` tag
, => or
img[width] => any img tags with a `width` tag
)
|(logical or) between them? Like:<img(?!.*width).*?>|<img(?!.*height).*?>. Not to mention you shouldn't parse HTML with regex.