title: Regex replace (in Python) - a simpler way?
body: <p>Any time I want to replace a piece of text that is part of a larger piece of text, I always have to do something like:</p>
  
  <pre><code>"(?P&lt;start&gt;some_pattern)(?P&lt;replace&gt;foo)(?P&lt;end&gt;end)"
  </code></pre>
  
  <p>And then concatenate the <code>start</code> group with the new data for <code>replace</code> and then the <code>end</code> group.</p>
  
  <p>Is there a better method for this?</p>