I need a regex to do the following (unfortunately it has to be a regex, I can't code this because it's working within a purchased product):
I'd like to select all image tags in a chunk of html where either the image tag does not contain a class attribute, or, if it does contain a class attribute, that attribute does not contain a specific string at the beginning. Basically, I want to strip (by matching) all image tags from a chunk of html EXCEPT for images with a particular class applied to them.
This could be two separate regular expressions - I just want to match them - not extract any data.
So, for example, let's say the class I want to keep is called Pretty.
I'd like the regex to match:
<img src="xx"/>
<img border="x" src="xx"/>
<img whatever other attributes src="xx"/>
<img class="ugly" src="xx"/>
<img whatever other attributes class="fugly" src="xx"/>
but not match
<img class="Pretty" src="xx"/>
<img whatever other attributes class="Pretty" src="xx"/>
<img class="Pretty subpretty" src="xx"/>
If it's easier to do in one regex (one to match all image tags without class attribute, and one to match ones with class attributes that aren't 'pretty') that's totally fine too.