title: Javascript replace regexp \\n with \n, \\t with \t, \\r with \r and so on
body: <p>I'm having an HTML Input field where the user can enter a delimiter.</p>
  
  <p>This delimiter can include <code>\n, \t, \r</code> and so on. When I append the delimiter to a string in javascript it is appended as \n instead of as a newline character.</p>
  
  <p>While I can use <code>str.replace(/\\n/g, "\n")</code> and so on to replace one variation it does not work if I write a general catch-all regexp like <code>str.replace(/\\([a-z])/g, "\$1")</code> since this just replaces \n with \n again.</p>
  
  <p>How do I have to rewrite the RegExp to replace all double backslashes in front of a character?</p>