title: Python regex sub using compile object
body: <p>I have a regex <code>&lt;type '_sre.SRE_Pattern'&gt;</code> and I would like to substitute the matched string with another string. Here is what I have:</p>
  
  <pre><code>compiled = re.compile(r'some regex expression')
  s = 'some regex expression plus some other stuff'
  compiled.sub('substitute', s)
  print(s)
  </code></pre>
  
  <p>and <code>s</code> should be </p>
  
  <pre><code>'substitute plus some other stuff'
  </code></pre>
  
  <p>However, my code is not working and the string is not changing.</p>