Let's say that I have an HTML markup like this:
<p>
<h1>Some header, which I don't want to match</h1>
Some text - match it.
<a href="some-file.html">Some link. Don't match neither href nor link text.<a>
<span>Some word, which needs to be matched</span>
</p>
In few words, I want to match some word in whole of the content, except given html tags (and their attributes). In given example I want to exclude h1 and a tags.
Expected result after replacing 'Some' by 'Test':
<p>
<h1>Some header, which I don't want to match</h1>
Test text - match it.
<a href="some-file.html">Some link. Don't match neither href nor link text.<a>
<span>Test word, which needs to be matched</span>
</p>