How to automatically remove trailing whitespace in Visual Studio 2008?
CodeMaid is a very popular Visual Studio extension and does this automatically along with other useful cleanups.
- Download: https://github.com/codecadwallader/codemaid/releases/tag/v0.4.3
- Modern Download: https://marketplace.visualstudio.com/items?itemName=SteveCadwallader.CodeMaid
- Documentation: http://www.codemaid.net/documentation/#cleaning
I set it to clean up a file on save, which I believe is the default.
Find/Replacing using Regular Expressions
In the Find and Replace dialog, expand Find Options, check Use, choose Regular expressions
Find What: ":Zs#$
"
Replace with: ""
click Replace All
In other editors (a normal Regular Expression parser) ":Zs#$
" would be "\s*$
".