in reply to Shooting at a Moving Target

I don't have time to write some code to demonstrate the idea, but I wonder if you could use a HoH (hash of hashes) in order to deconstruct the escape sequences, and from there perform your search and replace operations.

Alex / talexb / Toronto

"Groklaw is the open-source mentality applied to legal research" ~ Linus Torvalds