Given this HTML string:
<p class="">What a <span>classy</span> man!</p>
<p class="tag">He has so much class.</p>
I'd like to use Regex to get the two instances of 'class' that are between the HTML tags (i.e. not the class attributes). Note, the word 'class' could be another word but the results must not include anything from inside the HTML tags.
I have this so far: /(?<=\>)(.*?)(?=\<)/gi which gets all text between the tags but how do I change this to look for a specific word instead?
Ultimately, my aim is to wrap instances of 'class' with a <mark> tag. i.e. I need Regex so that I can change the string to look like this:
Thanks