<?php

if (preg_match_all('~\b(?!(?:word1|word2)\b)\w+~u', "Extract all words but word1 and word2.", $matches)) {
	print_r($matches[0]);
}