Find and Replace With Line Breaks in Eclipse
Often with doing a find and replace you want to use line breaks in the find (or replace) criteria. Sometimes I’ll have a column of data from a csv that I want to modify…whatever.
You can now check the “regular expressions” checkbox while doing a file search in Eclipse and specify “\R” to find or replace line breaks (platform independent).
Eg replace line breaks with commas:
Other interesting and useful options are:
- \t - tabs
- \n - newline
- \R - platform indepedent line delimiter
- \r - carriage return
- ^ - line start
This was introduced in Eclipse 3.4.x, read more here.