title: Removing backslash (escape character) from a string
body: <p>I am trying to work on my own JSON parser. I have an input string that I want to tokenize:</p>
  
  <p><code>input = "{ \"foo\": \"bar\", \"num\": 3}"</code></p>
  
  <p>How do I remove the escape character <code>\</code> so that it is not a part of my tokens?</p>
  
  <p>Currently, my solution using <code>delete</code> works:</p>
  
  <p><code>tokens = input.delete('\\"').split("")</code></p>
  
  <p><code>=&gt; ["{", " ", "f", "o", "o", ":", " ", "b", "a", "r", ",", " ", "n", "u", "m", ":", " ", "3", "}"]</code></p>
  
  <p>However, when I try to use <code>gsub</code>, it fails to find any <code>\"</code>.</p>
  
  <p><code>tokens = input.gsub('\\"', '').split("")</code></p>
  
  <p><code>=&gt; ["{", " ", "\"", "f", "o", "o", "\"", ":", " ", "\"", "b", "a", "r", "\"", ",", " ", "\"", "n", "u", "m", "\"", ":", " ", "3", "}"]</code></p>
  
  <p>I have two questions:</p>
  
  <p><strong>1. Why does gsub not work in this case?</strong></p>
  
  <p><strong>2. How do I remove the backslash (escape) character? I currently have to remove the backslash character with the quotes to make this work.</strong></p>