title: PowerShell Regex for nested XML tags
body: <p>I need to repair several huge buggy XML files.
  Because they are buggy, I cannot just do:</p>
  
  <pre><code>[xml]$xml = Get-Content .\data.xml
  </code></pre>
  
  <p>I want to parse them with captured groups.
  However, I don't know how to handle nested tags.</p>
  
  <p>Here is a simple example to illustrate my problem.</p>
  
  <pre><code>$xml = '&lt;tag&gt;&lt;tag&gt;&lt;tag&gt;Anything&lt;/tag&gt;&lt;tag&gt;Something else&lt;/tag&gt;&lt;/tag&gt;&lt;tag&gt;&lt;tag&gt;Another value&lt;/tag&gt;&lt;tag&gt;And another one...&lt;/tag&gt;&lt;/tag&gt;&lt;/tag&gt;'
  $Pattern = '&lt;tag&gt;(?&lt;Content&gt;.+?)&lt;/tag&gt;'
  ([regex]::Matches($Xml, $Pattern)).Value
  </code></pre>
  
  <p>This piece of code returns:</p>
  
  <pre><code>&lt;tag&gt;&lt;tag&gt;&lt;tag&gt;Anything&lt;/tag&gt;
  &lt;tag&gt;Something else&lt;/tag&gt;
  &lt;tag&gt;&lt;tag&gt;Another value&lt;/tag&gt;
  &lt;tag&gt;And another one...&lt;/tag&gt;
  </code></pre>
  
  <p>How can I change my Regex pattern to get this?</p>
  
  <pre><code>&lt;tag&gt;Anything&lt;/tag&gt;
  &lt;tag&gt;Something else&lt;/tag&gt;
  &lt;tag&gt;Another value&lt;/tag&gt;
  &lt;tag&gt;And another one...&lt;/tag&gt;
  </code></pre>
  
  <p>It seems that Regex recursion would fit my needs.
  However, I couldn't find someone explaining how it works with PowerShell (if ever...)</p>