package main import ( "fmt" "strings" ) func main() { input := `xxxxx:yyyyy:zzz.aaa.bbb.cc:dd:ee:ff` a := strings.FieldsFunc(input, Split) fmt.Println(a) } func Split(r rune) bool { return r == ':' || r == '.' }