I spent some time trying to figure out how to delete all blank lines in Visual Studio Code and I can't get it working. Anybody knows how to do it please?
If I search for ^$
while typing it in search field VSC does find the blank lines (completely blank lines, means no white spaces) but it doesn't remove them when I hit Replace All. It does nothing:
For blank lines with spaces ^\s+$
Search works, but it does not remove them. What it does is it replaces them with a blank line without spaces :))
It must be I am doing something wrong. I just can't figure out what is it. Anybody knows? Thanks.
$
doesnt actually match the new line character, it matches a zero-width token that exists before the new line character. To replace a new line you need to use\n
but VS Code doesn't currently support multi-line regex matches (#313) – Outflank