title: Javascript regular expression to remove double backslashes
body: <p>Having some trouble with backslashes regular expressions. I want to remove all dual backslashes (or any multiple of 2) that exist on any string property of an object. I do not want to remove single backslashes nor the last backslash in an odd number of backslashes (e.g., leave one backslash remaining in a set of five continuous backslashes \\\\\ -> \).</p>
  
  <p>The code is here:</p>
  
  <p><a href="http://jsfiddle.net/59Zau/" rel="nofollow">http://jsfiddle.net/59Zau/</a></p>
  
  <pre><code>//removes all dual backslahes on all string properties on an object
  var removeDualBackslash = function (obj) {
      var ret = null;
      if (typeof(obj) == "string") {
          obj = obj.replace(/\\\\/g,"");
          return obj;
      } else if (typeof(obj) == "number") {
          return obj;
      } else if (typeof(obj) == "array") {
          ret = [];
      } else {
          ret = {};
      }
      for (var key in obj)
          ret[key] = removeDualBackslash(obj[key]);
      return ret;
  };
  
  var oJSON = {"t4m_data_in":{"no_data":"No data \\passed in."}};
  
  oJSON = removeDualBackslash(oJSON);
  
  console.log(oJSON.t4m_data_in.no_data);​
  </code></pre>
  
  <p>As you can see from the console.log, one of the backslashes remains. Does anyone know what regular expression I need to remove both of them?</p>