title: Multiple sub-hashes out of one hash
body: <p>I have a hash:</p>
  
  <pre><code>hash = {"a_1_a" =&gt; "1", "a_1_b" =&gt; "2", "a_1_c" =&gt; "3", "a_2_a" =&gt; "3",
          "a_2_b" =&gt; "4", "a_2_c" =&gt; "4"}
  </code></pre>
  
  <p>What's the best way to get the following sub-hashes:</p>
  
  <pre><code>[{"a_1_a" =&gt; "1", "a_1_b" =&gt; "2", "a_1_c" =&gt; "3"},
   {"a_2_a" =&gt; "3", "a_2_b" =&gt; "4", "a_2_c" =&gt; "4"}]
  </code></pre>
  
  <p>I want them grouped by the key, based on the regexp <code>/^a_(\d+)/</code>.  I'll have 50+ key/value pairs in the original hash, so something dynamic would work best, if anyone has any suggestions.</p>