Question

How to search for carriage return in eclipse

If I have the following text in my Eclipse editor:

Text Line 1
Text Line 2

I would like to concatenate the text into:

Text Line 1Text Line 2

My first idea was to search for carriage return character '\n' and replace it with '' to concatenate it.

I tried using the search function of Eclipse, but it does not recognize carriage return character.

Are there any other editor that can do this?

 45  26856  45
1 Jan 1970

Solution

 71

Eclipse does this if you:

  • turn on regular expression mode in search/replace
  • enter \R for the newline
2009-09-08

Solution

 8

Just use Edit -> Find/Replace, switch on the Regular Expressions checkbox, search for \n and replace it by space.

I tried it in Eclipse 3.4 and it worked well.

2009-09-08