Thursday, 8 August 2013

Escape a group of characters with another character

Escape a group of characters with another character

I want to do some custom character escaping which means I want some
characters to be preceded with some special character only if they are not
already preceded by that special character. I assume I am going to need a
regex replace. What is the easiest way to achieve that? I tried something
with negative lookbehind assertion and ended up with nothing.
EDIT: Imagine that I want any of abc chars to be escaped with \, so giving
debby I should get de\b\by while out of da\bby I want to make d\a\b\by. I
guess this example is not that creative, nevertheless I believe it
explains what I mean (escape chars that are not yet escaped)

No comments:

Post a Comment