Hi!
There was "recently" a family libraries published for exactly this purpose:
https://github.com/jamesdbrock/replace-attoparsec
In the past I've done it character by character, but I definitely wasn't caring about performance then. I would assume the replace-* family of libraries are more efficient for the purpose
=======
Georgi