title: Using RegEx to balance match parenthesis
body: <p>I am trying to create a .NET RegEx expression that will properly balance out my parenthesis. I have the following RegEx expression:</p>
  
  <pre><code>func([a-zA-Z_][a-zA-Z0-9_]*)\(.*\)
  </code></pre>
  
  <p>The string I am trying to match is this:</p>
  
  <pre><code>"test -&gt; funcPow((3),2) * (9+1)"
  </code></pre>
  
  <p>What should happen is Regex should match everything from <code>funcPow</code> until the second closing parenthesis. It should stop after the second closing parenthesis. Instead, it is matching all the way to the very last closing parenthesis. RegEx is returning this:</p>
  
  <pre><code>"funcPow((3),2) * (9+1)"
  </code></pre>
  
  <p>It should return this:</p>
  
  <pre><code>"funcPow((3),2)"
  </code></pre>
  
  <p>Any help on this would be appreciated.</p>