title: Regex matching json node
body: <p>I need to extract one node value inside a particular node in a long JSON string. </p>
  
  <p>i.e. description node of person node:</p>
  
  <blockquote>
    <p>"<strong>person</strong>":{"age":"10", "<strong>description</strong>":"example",job:{"title":"sales","salary":"$3000"}, "sex":"male"}</p>
  </blockquote>
  
  <p>As using a JSON library to deserialize a long JSON string wasted too much time, I googled and found a regex to match one JSON node value and it works fast most of the time (taking a few ms)</p>
  
  <pre><code>Regex regex = new Regex("\"person\":{(?:[^{}]|(?&lt;open&gt;{)|(?&lt;-open&gt;}))*\"description\":\"(.*?)\"(?:.*?)(?(open)(?!))}");
  </code></pre>
  
  <p>It works slowly (using a full second) when a duplicated node name exists in some inner node after the match happened for an unknown reason:</p>
  
  <blockquote>
    <p>"person":{"age":"10", "<strong>description</strong>":"example", job:{"title":"sales", "salary":"$3000", "<strong>description</strong>":"example"}, "sex":"male"}</p>
  </blockquote>
  
  <p>I want to improve this regex efficiency so that it will only check the outermost content for the person node (bolded):</p>
  
  <blockquote>
    <p>"person":{<strong>"age":"10", "description":"example"</strong>, job:{"title":"sales", "salary":"$3000", "description":"example"}, <strong>"sex":"male"</strong>}</p>
  </blockquote>
  
  <p>I am new to regex, this regex may not suit my situation.<br>
  Any idea?</p>