title: How to replace json key value using javascript regular expression(when json is invalid)?
body: <p>I have a invalid json string like this:</p>
  
  <pre><code>[{
          "itemID": "1",
          "itemTitle": "Mango",
          "itemText": "some text here"again text",
          "ThumbUrl": "http://someurl.com/mango.jpg",
          "itemContent": null
      }, {
          "itemID": "2",
          "itemTitle": "orange",
          "itemText": "someother text " again another texther",
          "ThumbUrl": "http://someurl.com/orange.jpg",
          "itemContent": null
      }
  
  ]
  </code></pre>
  
  <p>javascript:</p>
  
  <pre><code>$.get("http://www.someapiurl.com/getdata.php", function(data, status){ 
  
  //here i want to replace json key value to empty before parsing the json  
       var json = $.parseJSON(data);
  
  }
  </code></pre>
  
  <p>I want to change the value of itemText to word empty using regular expression. Could any one help me how to achieve this using regular expression ?Thanks</p>
  
  <p><strong>Note:</strong></p>
  
  <p>-JSON is invalid (That is the way i recive it so i have to correct it before parsing it</p>
  
  <p>-The Json response some time got double quotes in itemText)</p>
  
  <p>-the itemText key value is across multiple lines(mix of unicode and non unicode)and long(not on online line) </p>
  
  <p><strong>Edit:</strong> I have used this php regular expression to achive same thing. Could you guys help me convert it to javascript regular expresion?</p>
  
  <pre><code>print_r(preg_replace('/\"itemText\"\:\".*?\"\,/s', '"textTitle$1":"empty",',$json));
  </code></pre>
  
  <p><strong>Edit2:</strong>
  Finally this replaced itemText with word empty for me in all cases:</p>
  
  <pre><code> data.replace(/("itemText"\s*:\s*")[\s\S]*?ThumbUrl/g, '$1empty","ThumbUrl')
  </code></pre>