Using plus in regex with sed

I was trying to remove trailing whitespace from some files with sed:

sed -i 's/[[:space:]]+$//g' some_file.py

But this left the file unmodified! For some reason, the pattern wasn't matching. I took a look at the man page and noticed the -E flag:

use extended regular expressions in the script (for portability use POSIX -E).

Turns out sed's basic regular expressions don't support + without enabling these extensions! I added the flag and my script started to work:

sed -E -i 's/[[:space:]]+$//g' some_file.py