I have a string coming from a telnet client. This string contains backspace characters which I need to apply. Each backspace should remove one previously typed character.
I'm trying to do this in a single replace using regular expression:
string txt = "Hello7\b World123\b\b\b";
txt = Regex.Replace(txt, ".\\\b", "", RegexOptions.ECMAScript);
Which results in "Hello World12". Of course, I want "12" to be removed too, but it obviously doesn't match my expression.
In some way, it should repeat replacing until there are no more matches. Any ideas on how to achieve this with a single regular expression?