import re
var1 = "abc"
var2 = "def"
var = 'abc1dois3quatro5def'
match = re.compile('{}(.*?){}'.format(var1, var2)).search(var)
if match is not None:
print(match.group(1))
else:
print('nada encontrado em {}'.format(var))
aW1wb3J0IHJlCnZhcjEgPSAiYWJjIgp2YXIyID0gImRlZiIKdmFyID0gJ2FiYzFkb2lzM3F1YXRybzVkZWYnCm1hdGNoID0gcmUuY29tcGlsZSgne30oLio/KXt9Jy5mb3JtYXQodmFyMSwgdmFyMikpLnNlYXJjaCh2YXIpCmlmIG1hdGNoIGlzIG5vdCBOb25lOgogICAgcHJpbnQobWF0Y2guZ3JvdXAoMSkpCmVsc2U6CglwcmludCgnbmFkYSBlbmNvbnRyYWRvIGVtIHt9Jy5mb3JtYXQodmFyKSk=