title: Can regular expressions be used to match nested patterns?
body: <p>Is it possible to write a regular expression that matches a nested pattern that occurs an unknown number of times? For example, can a regular expression match an opening and closing brace when there are an unknown number of open/close braces nested within the outer braces?</p>
  
  <p>For example:</p>
  
  <pre><code>public MyMethod()
  {
    if (test)
    {
      // More { }
    }
  
    // More { }
  } // End
  </code></pre>
  
  <p>Should match:</p>
  
  <pre><code>{
    if (test)
    {
      // More { }
    }
  
    // More { }
  }
  </code></pre>