title: Regex to match expression with multiple parentheses, one within each other
body: <p>I'm building a task (in PHP) that reads all the files of my project in search for i18n messages. I want to detect messages like these:</p>
  
  <pre><code>// Basic example
  __('Show in English')  =&gt; Show in English
  // Get the message and the name of the i18n file 
  __("Show in English", array(), 'page') =&gt; Show in English, page
  // Be careful of quotes
  __("View Mary's Car", array()) =&gt; View Mary's Car
  // Be careful of strings after the __() expression
  __('at').' '.function($param) =&gt; at
  </code></pre>
  
  <p>The regex expression that works for those cases (there are some other cases taken into account) is:</p>
  
  <pre><code>__\(.*?['|\"](.*?)(?:['|\"][\.|,|\)])(?: *?array\(.*?\),.*?['|\"](.*?)['|\"]\)[^\)])?
  </code></pre>
  
  <p>However if the expression is in multiple lines it doesn't work. I have to include dotail <code>/s</code>, but it breaks the previous regex expresion as it doesn't control well when to stop looking ahead:</p>
  
  <pre><code>// Detect with multiple lines
  echo __('title_in_place', array(
      '%title%' =&gt; $place['title']
    ), 'welcome-user'); ?&gt;    
  </code></pre>
  
  <p>There is one thing that will solve the problem and simplify the regex expression that it's matching open-close parentheses. So no matter what's inside <code>__()</code> or how many parentheses there are, it "counts" the number of openings and expects that number of closings.</p>
  
  <p>Is it possible? How? Thanks a lot!</p>