In Eclipse, how do I replace a character by a new line?

EclipseEditorText EditorEclipse 3.4

Eclipse Problem Overview


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 ?

Eclipse Solutions


Solution 1 - Eclipse

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

Solution 2 - Eclipse

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

Solution 3 - Eclipse

Like the others said, just use regular expression, but instead of just \r, put \r\n

Solution 4 - Eclipse

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.

Solution 5 - Eclipse

I'm using Helios and it works, however I had some issues with replacement... I wanted to place a line break between any of these brackets "><" (to make each new XML tag go to a new line)... first I had to place a chacter between the 2 brackets, for instance /r, after this i checked the "regular expressions" box and replaced the /r with \R, which resulted in the correct linebreak. otherwise, the replace seemed to be greyed out.

Solution 6 - Eclipse

if the file search is performed with Regular Expressions checkbox checked, then replace all / replace selected will also allow regular expression and will transform \n to a newline in the file(s)

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionpaulgregView Question on Stackoverflow
Solution 1 - EclipseDavid PierreView Answer on Stackoverflow
Solution 2 - EclipseLiamView Answer on Stackoverflow
Solution 3 - EclipseemersonblimaView Answer on Stackoverflow
Solution 4 - EclipsepaulgregView Answer on Stackoverflow
Solution 5 - EclipseloogieView Answer on Stackoverflow
Solution 6 - Eclipseuser9796835View Answer on Stackoverflow