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
相关问题
- Delete Messages from a Topic in Apache Kafka
- Jackson Deserialization not calling deserialize on
- How to maintain order of key-value in DataFrame sa
- StackExchange API - Deserialize Date in JSON Respo
- Difference between Types.INTEGER and Types.NULL in
The easiest way that I have done it is to use the regular expression form of replace.
Chances are that you don't want to replace the
{
, but just keep in my escaping them if you do want to do so.Hit
CTRL+F
and check theregex
checkbox. Then search for,
and replace it with,\n
.On intellij Ultimate 2017.1:
I didn't need regex. But I could make the multiline replace appear.
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.The is related but not exactly what you asked. But I needed it and I can imagine others do to. So I had the problem in Node.js where I wanted to split a reject into call into a log and reject for clarity
reject(error)
into
appLogger.log(error, 'error') reject(error)
In normal mode, I did find and replace
Then in regex mode I did a second find and replace:
You need to check the Regex box and use "\n" for the new line character: