In Intellij IDEA how do I replace text with a new line?

前端 未结 10 1221
忘掉有多难
忘掉有多难 2020-12-24 00:00

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

10条回答
  •  时光取名叫无心
    2020-12-24 00:33

    A clean approach would be to add (?m) in front of the regular expression, which turns on the multi line mode. This has the advantage that you can also use it in the global file search (Ctrl-Shift-F).

    Example: (?m)\{(.|\n)*?\} searches for multi-line blocks surrounded by curly braces.

提交回复
热议问题