simplified mixing of buffer as argument of str.replace