title: hierarchical regex expression
body: <p>Is it possible/practical to build a single regular expression that matches hierarchical data?</p>
  
  <p>For example:</p>
  
  <pre><code>&lt;h1&gt;Action&lt;/h1&gt;
    &lt;h2&gt;Title1&lt;/h2&gt;&lt;div&gt;data1&lt;/div&gt;
    &lt;h2&gt;Title2&lt;/h2&gt;&lt;div&gt;data2&lt;/div&gt;
  &lt;h1&gt;Adventure&lt;/h1&gt;
    &lt;h2&gt;Title3&lt;/h2&gt;&lt;div&gt;data3&lt;/div&gt;
  </code></pre>
  
  <p>I would like to end up with matches.</p>
  
  <pre><code>"Action", "Title1", "data1"
  "Action", "Title2", "data2"
  "Adventure", "Title3", "data3"
  </code></pre>
  
  <p>As I see it this would require knowing that there is a hierarchical structure at play here and if I code the pattern to capture the H1, it only matches the first entry of that hierarchy.  If I don't code for H1 then I can't capture it.  Was wondering if there are any special tricks I an employ to solve this.</p>
  
  <p>This is a .NET project.</p>