After giving it a try, the regex \s+$
does work.
explanation: \s
matches any single whitespace character. +
makes it match a series of whitespace characters. $
matches the end of the line. So, we're matching a series of whitespace characters immediately before the end of the line.