samedi 29 novembre 2014

Remove empty string characters from a javascript string


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


enter image description here


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
"




Aucun commentaire:

Enregistrer un commentaire