title: Nested capturing groups result
body: <p>How do I get an array like this</p>
  
  <pre><code>[
      0: [ "first", "value", "1" ],
      1: [ "second", "value", "2" ],
      2: [ "third", "value", "3" ]
  ]
  </code></pre>
  
  <p>or even better</p>
  
  <pre><code>[ "first", "value", "1", "second", "value", "2", "third", "value", "3" ]
  </code></pre>
  
  <p>from the string</p>
  
  <pre><code>"first.value[1].second.value[2].third.value[3]"
  </code></pre>
  
  <p>relying on a single <em>RegEx.exec()</em> run?</p>
  
  <p>I tried this:</p>
  
  <pre><code>regex = /\.*([\w]+)\.([\w]+)\[([\d]*)\]/g;
  var str = "first.value[1].second.value[2].third.value[3]";
  result = regex.exec(str);
  </code></pre>
  
  <p>but I can not get the sub-capturing-groups (like in the first example).</p>
  
  <p>PS - I would like to get the regular expression<strong>s</strong> for both type of results (<strong>flat array</strong> or <strong>nested arrays</strong>)</p>