replace gsub with builtin regsubst