https://play.golang.org/p/YoNyiKo-lTc
package main import ( "fmt" "regexp" ) func main() { s := `([^ ]+ ?)*` re := regexp.MustCompile(s) fmt.Printf("%q\n", re.FindStringSubmatch("aaa bbb ccc")) } I expect the output to be: > ["aaa bbb ccc" "aaa " "bbb " "ccc"] > > but the actual output is: > ["aaa bbb ccc" "ccc"] > > -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/977956eb-cd10-4221-a536-09b491667fae%40googlegroups.com.