This one is not really a code snippet, but is interesting. I coded some simple but relatively large assembly in notepad++ today. And since there was a lot of copy/paste things going on, I noticed that I had a lot of lines which ended in multiple tabs or spaces. Which bothered me a lot. So instead of going through all files and manually replacing them I did a little regex search/replace with notepad++.
This acts somewhat as a right trim function. Works flawlessly.