In Intellij IDEA how do I replace text with a new line?
Say I wanted to replace all commas with commas and a new line using Intellij IDEA's replace function. What do I put in the search box? In vim I'd use &\r
Solution 1:
You need to check the Regex box and use "\n" for the new line character:
Solution 2:
Use Multiline button, no Regex is needed.
edit: the multiline button is missing since IntelliJ 15, but you can enable it by clicking into the textfield and pressing Alt+Enter
or Ctrl+Shift+Enter
Solution 3:
Hit CTRL+F
and check the regex
checkbox. Then search for ,
and replace it with ,\n
.