Why does replace all not always replace all?

A DB I maintain supports a website. I’ve got docs for web pages, with template docs prefilled for different situations. So when I need to add a page I copy one of these template docs and replace the placeholders in it with the real values. The problem is that this sometimes skips one of the lines in the doc. So what I do is hit replace all/ok to confirm twice. Probably 90% of the time the second pass says it can’t find the string and 10% it does, after which a third pass won’t find it. This is in a rich text field by the way.

Of course if I forget to do it a second time, the odds are 99.9% it’ll be one of the cases where the second pass was needed. Is there some explanation for this behavior? Thanks.