In Python 2.6. it seems that markers of the end of string $ and \\Z are not compatible with group expressions. Fo example
import re
A [..] expression is a character group, meaning it'll match any one character contained therein. You are thus matching a literal $ character. A character group always applies to one input character, and thus can never contain an anchor.
If you wanted to match either a whitespace character or the end of the string, use a non-capturing group instead, combined with the | or selector:
r"\w+(?:\s|$)"
Alternatively, look at the \b word boundary anchor. It'll match anywhere a \w group start or ends (so it anchors to points in the text where a \w character is preceded or followed by a \W character, or is at the start or end of the string).