upgrade regex replace to use 'replace' mode