Thanks again for your help Steadyguy.
Here is what I have learned testing your code and mine:
I have done this:
$string_one = eregi_replace('es$', '*', $word);
$string = eregi_replace('s$', '*', $string_one);
Because, first, it looks at the end finshing by 'es' and AFTER he could try to find 's' at the end.
For the case "classes", it is fully functionnal, because the first line return "class" and then does not math the second line. That's why I have had "" for the replacement and not nothing '' as you propose.
I have done all the test upside down, and it's works correctly.
For the counting code, I agree, but my query return twice the entry, for example the query "cats bubbles" is returning with your code: "cats bubbles cat bubbl", that's why I decided to do the count. I know it is not perhaps the best way, but I am a PHP novice.....
MArc-André 😉