title: preg_match removes escaping from json string
body: <p>I am trying to parse some json data using json_decode function of php. However, I need to remove certain leading and trailing characters from this long string before decoding. Therefore, I am using preg_match to remove those characters prior to decode. For some reason, preg_match is changing escaping when it encounters following substring (in the middle of the string)</p>
  <pre><code>{content: \\\&quot;\\200B\\\&quot;}
  </code></pre>
  <p>After preg_match the above string looks like this:</p>
  <pre><code>{content: \\&quot;\200B\\&quot;}
  </code></pre>
  <p>Because of this, json_decode fails.</p>
  <p>FYI, the preg_match pattern looks like this:</p>
  <pre><code>(?&lt;=remove_these_leading_char)(.*)(?=remove_these_trailing_char)
  </code></pre>
  <p>OK, so here is the additional information based on the questions being asked:</p>
  <ol>
  <li><p>Why triple escaping? fix triple escpaing etc. The answer is that I don't have any control over it. It is not generated by my code.</p>
  </li>
  <li><p>The original string is not fully json compliant. It has several leading and trailing characters that need to be removed. Therefore I have to use regex. The format of that string is like this:</p>
  <p>returnedHTMLdata({json_object},xx);</p>
  </li>
  </ol>
  <p>It looks like this behavior is not limited to preg_match only. Even substr also does this.</p>