title: NLog Replace Layout Renderer not work with json content
body: <p>I use a third party package that depending on Nlog 4.7 and NLog.AspNetCore 4.8, and the package will write log.</p>
  <p>In my Nlog.config</p>
  <pre><code>&lt;logger name=&quot;package namespace&quot; level=&quot;Info&quot; writeTo=&quot;packageFile&quot; /&gt;
  &lt;target xsi:type=&quot;File&quot; name=&quot;packageFile&quot; fileName=&quot;${baseFilePath}/packageFile.log&quot; KeepFileOpen=&quot;true&quot; layout=&quot;${message}&quot; concurrentWrites=&quot;true&quot; /&gt;
  </code></pre>
  <p>It's work, but now I need replace content in message. I find <a href="https://github.com/NLog/NLog/wiki/Replace-Layout-Renderer" rel="nofollow noreferrer">Replace Layout Renderer</a> that is I need.</p>
  <p>The message is json string like this:</p>
  <pre><code>{&quot;ABC&quot;:{&quot;DEF&quot;:&quot;AA00014325&quot;,&quot;GHI&quot;:&quot;01&quot;}} 
  </code></pre>
  <p>I want to replace message become</p>
  <pre><code>{&quot;ABC&quot;:{&quot;DEF&quot;:&quot;A****14325&quot;,&quot;GHI&quot;:&quot;01&quot;}} 
  </code></pre>
  <p>This is the pattern I have used: [A-Z]\d{1}\d{2}
  I used this to test it against: <a href="https://regex101.com/" rel="nofollow noreferrer">https://regex101.com/</a></p>
  <p>Update:
  I also try the pattern by <a href="http://regexstorm.net/tester" rel="nofollow noreferrer">.NET Regex Tester</a></p>
  <p>My Nlog.config like this:</p>
  <pre><code>&lt;variable name =&quot;messageReplace&quot; value=&quot;${replace:inner=${message}:searchFor=[A-Z]\\d{1\}\\d{2\}:replaceWith=****:regex=true}&quot; /&gt;
  &lt;logger name=&quot;package namespace&quot; level=&quot;Info&quot; writeTo=&quot;packageFile&quot; /&gt;
  &lt;target xsi:type=&quot;File&quot; name=&quot;packageFile&quot; fileName=&quot;${baseFilePath}/packageFile.log&quot; KeepFileOpen=&quot;true&quot; layout=&quot;${messageReplace}&quot; concurrentWrites=&quot;true&quot; /&gt;  
  </code></pre>
  <p>But it's not work......</p>
  <p>I change my Nlog.config like this:</p>
  <pre><code>&lt;variable name =&quot;message1&quot; value=&quot;AA00014325&quot; /&gt;
  &lt;variable name =&quot;messageReplace&quot; value=&quot;${replace:inner=${message1}:searchFor=[A-Z]\\d{1\}\\d{2\}:replaceWith=****:regex=true}&quot; /&gt;
  &lt;logger name=&quot;package namespace&quot; level=&quot;Info&quot; writeTo=&quot;packageFile&quot; /&gt;
  &lt;target xsi:type=&quot;File&quot; name=&quot;packageFile&quot; fileName=&quot;${baseFilePath}/packageFile.log&quot; KeepFileOpen=&quot;true&quot; layout=&quot;${messageReplace}&quot; concurrentWrites=&quot;true&quot; /&gt; 
  </code></pre>
  <p>It's working...but if change message1 to</p>
  <pre><code>&quot;AA00014325&quot;
  </code></pre>
  <p>It not working again....Why?</p>
  <p>I want to replace json string in message, how can I do?</p>
  <p>Information:</p>
  <ul>
  <li>Platform : ASP.NET Core 3</li>
  <li>Nlog version : 4.7</li>
  <li>NLog.AspNetCore version : 4.8</li>
  </ul>
  <p>Thank you!</p>