text="red 1 green 3 blue"p text.split(/red|green|blue/)p text.split(/red|green|blue/, -1)p text.split(/red|green|blue/).reject(&:empty?)
Standard input is empty
["", " 1 ", " 3 "] ["", " 1 ", " 3 ", ""] [" 1 ", " 3 "]
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!