title: Python regexp groups: how do I get all groups?
body: <p>I am puzzled by this:</p>
  
  <pre><code>&gt;&gt;&gt; import re
  &gt;&gt;&gt; re.match(r"(?P&lt;all&gt;-(?P&lt;one&gt;\w+))*","-ab-cde-fghi-jkl-mn").groups()
  ('-mn', 'mn')
  &gt;&gt;&gt; re.match(r"(?P&lt;all&gt;-(?P&lt;one&gt;\w+)*)","-ab-cde-fghi-jkl-mn").groups()
  ('-ab', 'ab')
  </code></pre>
  
  <p>How do I get the list of all terms, ideally like</p>
  
  <pre><code>["ab","cde","fghi","jkl","mn"]
  </code></pre>
  
  <p>but </p>
  
  <pre><code>"-ab-cde-fghi-jkl-mn"
  </code></pre>
  
  <p>is fine too.</p>
  
  <p>(Please note that I am fully aware of <code>str.split("-")</code>. This is a question about <code>re</code> - <em>how to match the whole set</em>)</p>