Perchè questo funziona:


codice:
matches = {
    'a' : r'(.*)',
    'b' : r'\1',
}


asdf = re.sub( matches['a'],  matches['b'], 'Prova')        
print asdf

e questo no:


codice:
matches = {
    'a' : '(.*)',
    'b' : '\1',
}


asdf = re.sub(r''+ matches['a'],  r''+ matches['b'], 'Prova')        
print asdf