I have a requirement where I don't have to match a specific word when in occurs between anchor tag. Anchor tags can have other html tags nested.
For Example:
<a title="Test" href="http://www.google.com/"><span style="color: blue;">Test</span></a><p>Test - MANUALLY<br /><br /><a href="http://www.google.com">Google</a> </p><p> Resolving as duplicate of Test</p><p>Test test</p>
Here every "Test" gets selected. All I want here is getting only "Test" not present inside "anchor tag" and also not part of attributes of "anchor tag".
Regex I used was:
(?!<a[^>]*>)(Test)(?![^<]*<\/a>)/gi