improved replaceKeys regex