title: PHP RegExp for nested Div tags
body: <p>I need a regexp I can use with PHP's preg_match_all() to match out content inside div-tags. The divs look like this:</p>
  
  <pre><code>&lt;div id="t1"&gt;Content&lt;/div&gt;
  </code></pre>
  
  <p>I've come up with this regexp so far which matches out all divs with id="t[number]"</p>
  
  <pre><code>/&lt;div id="t(\\d)"&gt;(.*?)&lt;\\/div&gt;/
  </code></pre>
  
  <p>The problem is when the content consists of more divs, nested divs like this:</p>
  
  <pre><code>&lt;div id="t1"&gt;Content &lt;div&gt;more stuff&lt;/div&gt;&lt;/div&gt;
  </code></pre>
  
  <p>Any ideas on how I make my regexp work with nested tags?</p>
  
  <p>Thanks</p>