views:

2417

answers:

3

In Eclipse 3.3.2, I would like to replace a character (say ',') by a new line in a file. What should I write in the "Replace with" box in order to do so ?

EDIT : Many answers seems to be for Eclipse 3.4. Is there a solution for Eclipse 3.3.X ?

+3  A: 

Check box 'Regular Expressions' and use '\R' in the 'Replace with' box

It's a new feature introduced with Eclipse 3.4, See What's New in 3.4

David Pierre
doesn't seem to work (I've got 'R' instead of commas)
paulgreg
It does work for me with Eclipse 3.4
David Pierre
Check if Eclipse value assistance in the Replace with box offers you \R as a possibility, if it doesn't your Eclipse version doesn't handle it
David Pierre
I'm on version 3.3.2 and, the assistance doesn't show me that value.
paulgreg
A: 

I've just found an article about that problem. It seems to be a bug.

There's a workaround which is to copy a new line in clipboard and then paste it inside the "replace" box.

paulgreg
I am not able to make that workaround actually working...
paulgreg
I don't even understand what the workaround is supposed to be
David Pierre
You'll have to select the "new line character" by clicking on the last character's line and move the mouse before the first character on the next line. I indeed select something but I'm not able to paste it in the replace box.
paulgreg
Managed to paste using right click menu, but the replace won't insert newlines.
David Pierre
A: 

Check box 'Regular Expressions' and use '\n' in the 'Replace with' box

Liam
Yes, I tried that first but it is not working on my eclipse (3.3.2).
paulgreg