I am trying to remove trailing whitespace including \r and \n at the end of aspx files by using Find and Replace using the pattern
\s+(?!.)
trying to replace whitespace followed by nothing with nothing.
The result is that everything will come on the same line.
Why?
I also tried \s+$ with the same result.
>Solution :
You may add a negative lookahead to the end of your current pattern:
(\s+\r?\n)+$(?!.)
This will ensure that only final lines with whitespace only are matched. See the demo here.
