title: Perl regexp to find an element inside an element
body: <p>I need to find through regular expression from <code>&lt;div id="class1"&gt;</code> to end of <code>&lt;/div&gt;</code>. I may also have as many <code>&lt;div&gt;</code> within its text inside it. Please find the code below </p>
  
  <pre><code>This is example &lt;div id="class1"&gt;This is &lt;div id="subclass1"&gt;This is &lt;/div&gt; &lt;div id="subclass2"&gt;This is &lt;/div&gt; This is &lt;/div&gt; This is example
  </code></pre>
  
  <p>I have tried the below code. But it gets only up to first <code>&lt;/div&gt;</code> of <code>&lt;div id="subclass1"&gt;</code>
  Could any help me to solve this?</p>
  
  <p>Code I tried to capture is:</p>
  
  <pre><code>&lt;div id="class1"&gt;(?:(?!&lt;\/div&gt;).)*?&lt;/div&gt;
  </code></pre>