How to replace one line to two lines or more on a text file using the "find and replace mode"?
Solution 1
Depending on how your file's line endings are formatted (I'm going to assume Windows linebreaks since you said VB), you can switch the Search Mode to Extended and do something like this:
Find what: strLine
Replace with: line1\r\nline2
Solution 2
Its quite easy. If you look in the search mode you have an "Extended" mode. Use the special chars, like \n for newline.
Related videos on Youtube
Comments
-
Diogo over 1 year
Right now I'm developing a script with vbscript and I need to find one specific line(with a lot of occurrences) on a 5k lines source code and replace it to two new code lines(1 line to 2 lines replacement).
I'm using Notepad++ but as far I could use any another editor to my development, I could someday confront with the same problem editing any kind of text file. I already tried to find a way on Notepad++, MS Word and even on Windows Notepad and didn't found any solution(all of them just replaced the search ocurrence with the first line of the replacement text).
There is some way to replace one text line to two or more lines when find an occurrence with Ctrl+F or Ctrl+H on a text editor?
-
Diogo about 12 yearsThanks for the help, but it didn't actually works, notepad++ interpreted \n just as "\n", I mean, the replacement stayed with "line1\r\nline2" text.
-
KingRadical about 12 yearsDid you make sure to switch the Search Mode to Extended?
-
Diogo about 12 yearsWow, this really worked.... When I read the "Extended(\n, \r, \t, \x..." option I didn't really understood what it is intended to do... Thank you very much.
-
Diogo about 12 yearsSorry, I didn't see you told to switch to Extended mode, I will accept yours as the main answear because you answeared the solution first. Thank you.