I have a string from a DOM element, which contains something similar to the following:
<span class='greenhornet'>Can you catch the green?</span>
I need to know the position of the word green.
In this case, if I setup a pattern /green/, JS exec() of course will return the first occurrence of green (position 13).
Is there a way to tell JS regexp to ignore ! the word green, if it's between < and > or is there an easier way to do this?
Oh, and I can't just strip the HTML either!
thanks.
document.getElementsByClassNamefor example?<b>green</b>hornet.