title: Python: Replace with regex
body: <p>I need to replace part of a string. I was looking through the Python documentation and found re.sub.</p>
  
  <pre><code>import re
  s = '&lt;textarea id="Foo"&gt;&lt;/textarea&gt;'
  output = re.sub(r'&lt;textarea.*&gt;(.*)&lt;/textarea&gt;', 'Bar', s)
  print output
  
  &gt;&gt;&gt;'Bar'
  </code></pre>
  
  <p>I was expecting this to print <code>'&lt;textarea id="Foo"&gt;Bar&lt;/textarea&gt;'</code> and not 'bar'. </p>
  
  <p>Could anybody tell me what I did wrong?</p>