Only replace keywords that are not inside of an anchor:
// replace
... keyword ... -> ... <a href="url">keyword</a> ...
// not replace
...<a href=""> ... keyword ... </a>... -> ...<a href=""> ... keyword ... </a>...
Please provide a suitable pattern to accomplish this.
Note: I am working over a string type variable, not over a HTML document!
EDIT: Ok, Ok. I'll use an HTML parser, thanks!