tags:

views:

439

answers:

3

How can I remove lines that only contain spaces when using Eclipse Find/Replace prompt. I checked the "Regular Expression" check box, and tried the following, neither of which worked.

^[:space:]*$

and

^\s*$
+1  A: 

sry this might be an different answer but you can set the number of blank lines you wish to have after fields, methods and blocks in the formatting dialog of the eclipse preferences. then you can hit ctrl-shift-f to automatically format your code depending on your custom definitions.

have fun!

smeg4brains
The file I am attempting to replace the blank lines from is not a source code file.
Steve
you might try to add the desired filetype to your eclipse file associations under "Preferences/General/Editors/File Associations" and link it with a specific editor, which is capable of handling your source files.
smeg4brains
+4  A: 

Find: ^\s*\n

Replace with: (empty)

Iamamac
A: 
  1. for the find/replace operation, "\n\r\s" regex will work on windows, for unix based system, "\n\s" can be used
  2. as already suggested, you can format your code by Ctl+Shift+F
  3. for manual work, locate a blank line and press Ctl+D <- gives u satisfaction of killing the line with your own bare hands :)

cheer!

Amit