Let's say I have some text:
<hello> <world> <:how> are <you>
Now I want to HTML-encode it so that the <>
s don't mess things up. But <:how>
is special because it has a :
in it, so I don't want to touch that.
I can replace it using a regex with something like {{how}}
, then do the HTML encoding, and then replace it back.
But what if {{something}}
already appears somewhere in the code? Then {{something}}
would get converted to <:something>
when it should have been left as is.
I've encountered this problem a few times in the past, and still haven't found a good way to approach it. Do people just choose something really obscure to replace with and hope that it doesn't exist elsewhere, or is there a proper way to do this?