Using preg_grep()
<? $text=<<<TEXT "asdf.asdf,asdf!asdf TEXT; $words = preg_split('/[",.!\s]/', $text, -1, PREG_SPLIT_NO_EMPTY); $double_letter_words = preg_grep('/([a-z])\\1/i',$words); foreach ($double_letter_words as $word) { print "$word\n"; } ?>