title: python match only captures first and last group - am I misunderstanding something?
body: <p>I'm working on a little Python script that is supposed to match a series of authors and I'm using the <code>re</code>-module for that. I came across something unexpected and I have been able to reduce it to the following very simple example:</p>
  
  <pre><code>&gt;&gt;&gt; import re
  &gt;&gt;&gt; s = "$word1$, $word2$, $word3$, $word4$"
  &gt;&gt;&gt; word = r'\$(word\d)\$'
  &gt;&gt;&gt; m = re.match(word+'(?:, ' + word + r')*', s)
  &gt;&gt;&gt; m.groups()
  ('word1', 'word4')
  </code></pre>
  
  <p>So I'm defining a 'basic' regexp that matches the main parts of my input, with some recognizable features (in this case I used the <code>$</code>-signs) and than I try to match one word plus a possible additional list of words.</p>
  
  <p>I'd have expected that <code>m.groups()</code> would've displayed:</p>
  
  <pre><code>&gt;&gt;&gt; m.groups()
  ('word1', 'word2', 'word3', 'word4')
  </code></pre>
  
  <p>But apparently I'm doing something wrong. I'd like to know why this solution does not work and how to change it, such that I get the result I'm looking for. BTW, this is with Python 2.6.6 on a Linux machine, in case that matters.</p>