Remove empty lines in Netbeans 7.x [closed] Remove empty lines in Netbeans 7.x [closed] php php

Remove empty lines in Netbeans 7.x [closed]


You can do this with a regular expression + and a replacement. Do this in an editor window or in the project (or files) directory tree:

  • Ctrl + H
  • Check "Regular Expression"
  • Search for \n\n
  • Replace with \n
  • Click "Replace all" until all lines are deleted

If you want to keep a blank line you should:

  • Search for \n\n\n
  • Replace with \n\n

If you want to replace consecutive lines that are not empty but contain whitespaces only you should:

  • Search for \n[\t\r]+$\n
  • Replace with \n


Try this one...

Ctrl + F (find) in Netbeans as Regular Expression:

\n\s*(\n)

and Replace All by

$1


In NetBeans 7.3 (I'm not sure about the earlier version, it should be available in 7.x)

Automatic removal:

Tools > Options > Editor > On Save > Remove Trailing Whitespace:

you can choose from: "None / All Lines / Modified Lines Only"

Manual way:

Alt + Shift + F