title: Regex.test is giving me an error
body: <p>I have the following javascript...</p>
  
  <pre><code>$.post(url, data, function (json) {
          var patt = new RegExp('/^\[{"dID":/');
          if (patt.test(json)) {
  
              //output json results formatted
  } else {
  
          //error so output json string
              $('#diaryTable').replaceWith(json);    
  
          }
      }, 'json');
  </code></pre>
  
  <p>Basically my json should either be a valid json which begins with </p>
  
  <p><strong>[{"dID":</strong> </p>
  
  <p>or it will be </p>
  
  <p><strong>[{</strong> <em>the ex.Message from try catch exception...</em> <strong>}]</strong></p>
  
  <p>Unfotunately I get the error <strong>JavaScript runtime error: Expected ']' in regular expression</strong></p>
  
  <p>I have check my RegEx /^[{"dID":/ at RegEx101.com with some test data and my test worked as expected. Any ideas anyone?</p>