I am trying to identify text that is not part of another word (which I have working successfully), but I also want to ensure that the text is not inside an <a>
tag.
"Java <li>Javascript</li> <a href="">Some Java here</a> more java"
var regex2 = new RegExp(`(?<![a-z])Java(?![a-z])`, "gi");
text = text.replace(regex2, '++JavaUpdated++');
The code snippet above works fine, however when I tried to include additional lookarounds as shown below, it didn't work as expected:
var regex2 = new RegExp(`(?<![a-z])(?<!<a.*)Java(?!.*<\/a>)(?![a-z])`, "gi");