I would use `sub` instead of `gsub`, and start the regex with `/^[^:]*` instead of `.*` so you don't capture more colons than you intend.