Windows – How to replace one line to two lines or more on a text file using the “find and replace mode”

find and replacesearchtext-editorswindows

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).

enter image description here

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?

Best Answer

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
Related Question