title: Extract substring using sed
body: <p>I have a log file of the following:</p>
  
  <pre><code>example.com - - - 127.0.01 [22/Sep/2013:07:22:22 +0000]  "POST /api/test.php HTTP/1.1" 200 355 "-" "-" "{\x22id\x22:\x22 ... }}}"
  
  example.com - - - 127.0.01 [22/Sep/2013:07:22:22 +0000]  "POST /api/test.php HTTP/1.1" 200 355 "-" "-" "{\x22id\x22:"{\x22 ... }}}"
  </code></pre>
  
  <p>I want to extract the first <code>{\x22</code> to the last <code>}</code></p>
  
  <p>So I am using the following sed command:</p>
  
  <pre><code>cat test.txt  | sed -r  's/.+?"(\{.+\})".*/\1/g'
  </code></pre>
  
  <p>However, it give me</p>
  
  <pre><code>{\x22id\x22:\x22 ... }}}
  
  {\x22 ... }}}
  </code></pre>
  
  <p>But I want</p>
  
  <pre><code>{\x22id\x22:\x22 ... }}}
  
  {\x22id\x22:"{\x22 ... }}}
  </code></pre>