title: Matching a class with Regex in C#
body: <p>Iam looking for a way to match a full class, starting with the first bracket and ending with the closing bracket. I need this for an add-in, to limit the area the add-in should be applied to. My Problem is, that in those classes, there could be extra "sub-classes", also having brackets opening and closing. I would need a way to count those and ignore them until i find the right closing bracket of the first class.</p>
  
  <p>Example: </p>
  
  <pre><code>public class Test
  **{**
  
   doSomeThing();
  
   private partial class Test2
     {
       doSomeThing2();
     }
  **}**
  </code></pre>
  
  <p>I need the match from the first marked bracket to the last one.</p>
  
  <p>Thanks for any help!</p>