title: "Uncaught SyntaxError: Unexpected token ?" in both JSON.parse() and $.parseJSON()
body: <p>I have no idea why I am getting this and I have spent over a day trying to mess with the code. Now the simplest I can get is this (Trying to build a javascript array with an escaped string coming from a database):</p>
  
  <pre><code>vat test = '["&lt;script&gt;var bob = \\"This is ok\\"&lt;/script&gt;", "&lt;script&gt;search.replace(/!|\\\?)/g, \\"\\")&lt;/script&gt;"]';
  </code></pre>
  
  <p>So far, so good.</p>
  
  <p>Then this breaks and returns the error:</p>
  
  <pre><code>JSON.parse(test);
  </code></pre>
  
  <p>To give an idea, the original 2 array items were this:</p>
  
  <pre><code>&lt;script&gt;var bob = "This is ok"&lt;/script&gt;
  &lt;script&gt;search.replace(/!|\?)/g, "")&lt;/script&gt;
  </code></pre>
  
  <p>All the codes of any kind that were entered in the database have always worked, except now, because of that question mark from a user-entered line in my CMS. If I remove it or replace the question mark by anything else, it works.</p>
  
  <p>I cannot change the regex so to make it work any other way, I am not the one who entered this. Plus this is a simplified version of a whole script, I just narrowed it to the question mark.</p>
  
  <p>I also looked online if the question mark had a special meaning for json, did not find anything.</p>
  
  <p>I wish I could have sent a fiddle instead of just code, but jsfiddle doesn't let me add the  tag in the javascript window.</p>