Update string format method in _replace_sub function.