D:\>perl -pe "s/( +|\t\t+)$//g" test.html
4 spaces 1 space
2 tabs 1 tab
D:\>perl -pe "" test.html
4 spaces 1 space
2 tabs 1 tab
D:\>
D:\>perl -pe "s/( +|\t\t+)$//g" test.html
4 spaces 1 space
2 tabs 1 tab
D:\>perl -pe "" test.html
4 spaces 1 space
2 tabs 1 tab
D:\>