Localize gsub function.