|Syntactic Confectionery Delight|
supported by linked substrings.
Seems to me you are looking for a complex solution when a simple one will do.
In order to mark your substrings, you have to know where they start and end|length.
If you simply unpack the string into an array on those same boundaries, you can edit the individual elements to your hearts content, and when you pack/join them back together, you will have exactly the same effect as your linked substrings without the overhead of all the behind-the-scenes jiggery pockery required to make the latter work.
It's simple. And I like simple :)
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.