How things are broken into units upon which scanning is performed is a pivotal part of this.
I maintain, at the level of words within a unit, if that unit is a sentence, once a substitution has taken place to an "atom in that molecule" that there should be no additional processing for *that* *atom*. You can continue with the remainder of atoms in the molecule.
Think about how regexes themselves work. I have even seen recursive ones, but those are very, very seldom used. They don't keep re-replacing what has already been replaced. That's my issue. I don't want something I've identified, as an atom of the original examined molecule, to be replaced more than once.
Brian - Windows 10 Pro, 64-Bit, Version 20H2, Build 19042
Always remember others may hate you but those who hate you don't win unless you hate them. And then you destroy yourself.
~ Richard M. Nixon