I am using sed to keep only a single colon at the start of a string.
string=$( printf "%s\n" "$string" | sed 's/^::*/:/' )
Could this be done in bash using something like
[[ $string =~ regex ]]
with a regex group that will contain the parts of the string as required ?