+9

Search and Replace should allow inserting newlines in the replace section

Markus Peter 6 years ago • updated by Bobex Stojanovic 2 years ago 12
It should be possible to insert newlines into the "replace" section of Search and Replace

+16
This can currently be accomplished two ways:
  • Use Ctrl+Enter to insert a newline in the Replace field (the field probably should increase in height but doesn't now)
  • If S&R regex mode is turned on, use \n in the Replace field to insert a newline.

-7

Ctrl+Enter put the newline at the end of the replace text, not in the middle where I entered it.

+3

You can resize the find/replace panel by dragging its upper border (note that there was a resize cursor in place of that ugly red arrowhead, PrtScn didn't capture the original one unfortunately :)):


I agree that the whole thing could be better. Anyway, what I wanted is a little bit different, how can we find and replace "\r" and/or "\n" (not as a literal string, but as LF and CR characters)?

+1

If you enable regular expression (Alt + r), you can search for \n

+1

Yeah, but you can't search for \r and definitely can't replace with \n or \r (you can replace with "new-line" which is I guess dependent on the file and new-line settings).


PS: What I'd like to have would be similar to Notepad++'s "extended" option in search/replace. I occasionally find myself switching to Notepad++ for new line (and encoding) things.

It works, enable regular expression and you can search and replace any special character.

Doesn't work for \r (hence \r\n)...

Which version? I've got 2.0.1 and it doesn't seem to have this. Also, button count and UI are different from mine too.

-1

Oh I see, I use version 3 beta (Build 3012)

Nice to see that it's implemented in v. 3. I hope it rolls out soon.

in ST3 "\n" Perfectly works ith for new row(line), without "" :)

- for example:

Find What: ;

Replace: ; \n

Result is:

e=[];
f=b(d,function(a){return 1===a.priority});
d=f.length ...ect

For something like:

e=[];f=b(d,function(a){return 1===a.priority});=f.length

And that is what we want.