import reprint( re.findall(r"\b(?!(?:word1|word2)\b)\w+", "Extract all words but word1 and word2.") )
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!