How to use sed to substitute commands with parts of the matched pattern
===

Trying to change files in-place that contain:

    self.vars['stuff']

so that they are substituted with:

    self.v.stuff

I tried using:

    sed -e "s/self.vars\['/self.v./" -e "s/'\]//"

However that will affect other lines that happen to have '] in it too. 

Halp!