Hi., thanks for your answer and for your time :)
I had several problems with the DOM, and this one is only one of them...
I'm trying now with regular expressions , and I use a trick: I had some dirty chars nex to the occurences I don't want to rerplace (1-already a link 2-inside a tag definition), and after I simply replace all the others, then I delete the dirty chars I added before. The algo can work. Actually, it does, except I still have 3 problems:
=> this one put ##### before the keyword if this one is a link
$content = preg_replace( '|(<a[^>]+>)(.*)('.$keyword.')(.*)(</a[^>]*>)|Ui', '$1$2#####$3$4$5', $content);
1 - sometimes the keyword can appear more than once inside the link and this regexp replaces it only once. There should be an instruction to ask to target all the occurences but I'm still learning and I don't find it. Furthermore, the U flag makes the regexp to match only the first occurence, and without the U flag, I match only the last one. Weird.
2 - sometimes I have 2 links inside $content , and the regexp matches blablsablabla </a><a href='....'> dsrg dsfg gdf => in that case I try to add the condition "not contain </a> in $2 and $4 but I still block on the syntax.
3 - last problem: sometimes my keyword can contains some * or . , etc.... I'm still looking rof a way to escape special chars in my strings in a generic way.
This is where I am today, and at this stage I have better results than with the DOM...