text = 'Extract all words but word1 and word2.'p text.scan(/\b(?!(?:word1|word2)\b)\w+/);
Standard input is empty
["Extract", "all", "words", "but", "and"]
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!