Using gsub instead of split/join