title: Regular Expression to Identify If Statements
body: <p>I'm trying to write a regular expression to identify an if statement. The only problem I'm having is getting it capture if statements that have parentheses in their parenthesis. For example:</p>
  
  <pre><code>if (condition_function(params)) {
       statements;
  }
  </code></pre>
  
  <p>My expression to capture all if statements except these is:</p>
  
  <pre><code> if\s*\(([^\(\)]|\s)*\)\s*{(.|\s)*?}
  </code></pre>
  
  <p>Does anyone know how to write that?</p>