class Ideone {
static void main(String[] args) {
String text = "red 1 green 3 blue"
println(text.split(/red|green|blue/))
println(text.split(/red|green|blue/, -1))
println(text.split(/red|green|blue/).findAll {it != ""})
}
}
Y2xhc3MgSWRlb25lIHsKICAgIHN0YXRpYyB2b2lkIG1haW4oU3RyaW5nW10gYXJncykgewoJCVN0cmluZyB0ZXh0ID0gInJlZCAxIGdyZWVuIDMgYmx1ZSIKCQlwcmludGxuKHRleHQuc3BsaXQoL3JlZHxncmVlbnxibHVlLykpCgkJcHJpbnRsbih0ZXh0LnNwbGl0KC9yZWR8Z3JlZW58Ymx1ZS8sIC0xKSkKCQlwcmludGxuKHRleHQuc3BsaXQoL3JlZHxncmVlbnxibHVlLykuZmluZEFsbCB7aXQgIT0gIiJ9KQogICAgfQp9Cg==