text <- 'Extract all words but word1 and word2.'regmatches(text, gregexpr("(*UCP)\\b(?!(?:word1|word2)\\b)\\w+", text, perl=TRUE))
Standard input is empty
[[1]] [1] "Extract" "all" "words" "but" "and"
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!