title: Remove empty string characters from a javascript string
body: <p>I'm using regex to remove keypresses from a string thats being inputed from a telnet client (node.js)
  but my regex expression, <code>input.replace(/\[(B|C|D|A)/gm,&quot;&quot;);</code> seems to be having some weird effects</p>
  <p><img src="https://i.stack.imgur.com/TN9lI.png" alt="enter image description here" /></p>
  <p><code>string</code> being my input is that snapshot.</p>
  <p>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?</p>
  <p>here's the input string
  <a href="http://s21.postimg.org/91e01id13/input.png" rel="noreferrer">http://s21.postimg.org/91e01id13/input.png</a>
  as a string its</p>
  <pre><code>&quot;[D[A[C[D[B[D[A[B[C[Dhhh
  &quot;
  </code></pre>
  <hr />
  <p>hitting the left arrow key twice and typing <code>hello</code> looks like this <code>&quot;%1B%5BD%1B%5BDhello%0D%0A&quot;</code> afer <code>encodeURIComponent(string);</code></p>