Home > Net >  Remove trailing whitespace at the end of aspx file
Remove trailing whitespace at the end of aspx file

Time:12-02

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.

enter image description here

CodePudding user response:

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.

  • Related