title: \2 mean in regular expression
body: <p>As of my understanding \2 represents the contents of group 2.</p>
  
  <p>So, the expression <code>r'(\w*)(\w)\2'</code> should return the contents of group2( i.e <code>\w</code>)
  but when we use the word having repeated characters it is returning repeated characters.
  example:</p>
  
  <pre><code>re.search(r'(\w*)(\w)\2','finally').group(2) -&gt; 'l'
  re.search(r'(\w*)(\w)\2','finallyy').group(2) -&gt;'y'
  </code></pre>
  
  <p>In the 1st example the output is 'l' instead of 'y'.</p>
  
  <p>Can anyone tell me what exactly \2 mean in regular expression and where does my understanding is wrong.</p>