title: The groups() method in regular expressions in Python
body: <p>I am learning about regex in Python and I have problems understanding the function <code>groups()</code>.</p>
  
  <pre><code>&gt;&gt;&gt; m = re.match("([abc])+", "abc")
  </code></pre>
  
  <p>Here I have defined the class [abc], which as I know, means any of the characters a to c. It's defined inside a group and the + sign means we want at least one of such groups. So I execute the following line and the result is understandable:</p>
  
  <pre><code>&gt;&gt;&gt; m.group()
  'abc'
  &gt;&gt;&gt; m.group(0)
  'abc'
  </code></pre>
  
  <p>I get why this happens. The index of the main group is 0 and 'abc' matches the class we have defined. So far so good, but I don't get why the following lines get executed the way they do:</p>
  
  <pre><code>&gt;&gt;&gt; m.group(1)
  'c'
  &gt;&gt;&gt; m.groups()
  ('c',)
  </code></pre>
  
  <p>What is group(1), I have only defined one group here and why the groups function has only the character 'c' in it? Isn't it supposed to return a tuple containing all the groups? I'd suppose it would at least contain 'abc'.</p>