text = "The (New York city) :) is big"arr = text.scan(/\(([^()]+)\)|(\S+)/).flatten - [nil]p arr
Standard input is empty
["The", "New York city", ":)", "is", "big"]
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!