title: Python re.sub question
body: <p>Greetings all,</p>
  
  <p>I'm not sure if this is possible but I'd like to use matched groups in a regex substitution to call variables.</p>
  
  <pre><code>a = 'foo'
  b = 'bar'
  
  text = 'find a replacement for me [[:a:]] and [[:b:]]'
  
  desired_output = 'find a replacement for me foo and bar'
  
  re.sub('\[\[:(.+):\]\]',group(1),text) #is not valid
  re.sub('\[\[:(.+):\]\]','\1',text) #replaces the value with 'a' or 'b', not var value
  </code></pre>
  
  <p>thoughts?</p>