in reply to Re: Stripping Comments
in thread Stripping Comments

The problem with the first RE is that it removes the character before the hash mark. In your examples, it's always whitespace, so you didn't recognize it. You could replace the first regex with
s/([^\\])#.*/$1/;
Better yet, replace the first and second RE with the RE that varian provides. You'll need the third RE nonetheless.