title: Why does re.sub replace the entire pattern, not just a capturing group within it?
body: <p><code>re.sub('a(b)','d','abc')</code> yields <code>dc</code>, not <code>adc</code>.</p>
  
  <p>Why does <code>re.sub</code> replace the entire capturing group, instead of just capturing group'(b)'?</p>