in reply to Duplicate Words

The main thing that will help you here is to realize that you can use parentheses around the part of the regular expression that matches any word, and then use "\1" in the same regular expression to test for the immediate second occurrence of that word. Actual code of course is the assignment. If you tell us when it's due, maybe we'll post solutions (probably pithier than teacher's :-) afterwards.