title: How to match string within parentheses (nested) in Java?
body: <p>I would like to match a string within parentheses like:</p>
  
  <pre><code>(i, j, k(1))
  ^^^^^^^^^^^^
  </code></pre>
  
  <p>The string can contain closed parentheses too. How to match it with regular expression in Java  without writing a parser, since this is a small part of my project. Thanks!</p>
  
  <p><strong>Edit:</strong></p>
  
  <p>I want to search out a string block and find something like <code>u(i, j, k)</code>, <code>u(i, j, k(1))</code> or just <code>u(&lt;anything within this paired parens&gt;)</code>, and replace them to <code>__u%array(i, j, k)</code> and <code>__u%array(i, j, k(1))</code> for my Fortran translating application.</p>