I'm using regex to remove keypresses from a string thats being inputed from a telnet client (node.js)
but my regex expression, input.replace(/\[(B|C|D|A)/gm,""); seems to be having some weird effects

string being my input is that snapshot.
How do I remove those empty strings regex is putting at the beginning or is there a better way to write the expression so that they aren't created?
here's the input string http://s21.postimg.org/91e01id13/input.png as a string its
"[D[A[C[D[B[D[A[B[C[Dhhh
"
hitting the left arrow key twice and typing hello looks like this "%1B%5BD%1B%5BDhello%0D%0A" afer encodeURIComponent(string);
inputvariable?