This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
You will need to look up regular expressions if you want to work with these sorts of issues. Tim's solution is 99% there, and a simple look at a the regular expression he used for word matching shows that the problem is with the definition of a word. He used "\w", which matches on "A-Z", "a-z", and "0-9". Note that this is slightly different in Perl, which also includes "_" in it's definition of what a word is.
Knowing this, I can make a far more verbose attempt in sed:
Note that I used the capital "-E" for extended (modern) regular expressions. Depending on your host's implementation of sed this may not be necessary for you.