title: Refer to group inside group with Regex
body: <p>I am trying to find a regex that groups a word that ends on two identical symbols followed by 'ter' and splits it on the two symbols.
  Example: The word 'Letter' should be grouped into 'Let' and 'ter'.
  I'm using python and this is what i've gotten so far:</p>
  
  <pre><code>match = re.search(r'(\w*)((\w)\1(er$))', str)
  print match.group(1) #should print 'Let'
  print match.group(2) #should print 'ter'
  </code></pre>
  
  <p>The problem is that the (\w)\1 doesn't refer to the right group, because it's a group inside a group. How is this solved?</p>
  
  <p>Thanks in advance.</p>