I'm trying to replace the keyword "site" with "Stack Overflow" in the source string, but it should only replace when the keyword is not inside a HTML <a>
tag or between <a>
and </a>
.
I've searched a lot and unfortunately haven't found a solution yet.
What I want:
Right now, site is available at <a href="http://www.example.com/site">site.com</a>
...should replace to...
Right now, Stack Overflow is available at <a href="http://www.example.com/site">site.com</a>