get all inner brackets/parentheses
<p>I'm working on getting all inner parentheses of a string in JavaScript.</p>

<p>For example if I have a string like that (don't bother about % signs, Qx values are surrounded with it)</p>

<pre><code>((!%Q1% || %Q2%) || ((%Q3% &amp;&amp; %Q4%) || (%Q5% &amp;&amp; %Q6%)))
</code></pre>

<p>I would like to get in my result:</p>

<pre><code>(!%Q1% || %Q2%) || ((%Q3% &amp;&amp; %Q4%) || (%Q5% &amp;&amp; %Q6%))
(!%Q1% || %Q2%) 
(%Q3% &amp;&amp; %Q4%) || (%Q5% &amp;&amp; %Q6%)
(%Q3% &amp;&amp; %Q4%)
(%Q5% &amp;&amp; %Q6%)
</code></pre>

<p>Basically I'm looking for some universal way, not only for example above. I was trying to do so using something like that in loops, but it was working only for much simpler examples (with less parentheses)</p>

<pre><code>init = condition.indexOf('(');
fin = condition.lastIndexOf(')');
inner = condition.substr(init+1,fin-init-1);
</code></pre>

<p>I would like to use only JS, but other solutions are welcome.</p>