The problem is that in Notepad ++, search using regular expressions works cyclically when using mass (global) replacement. Replacing the 3rd row, the index is located at the beginning again, and the 6th row becomes the 3rd, and so on.
In this case, you need to find a match equal to the entire document. You can use
\A((?:.*\R){2}).*((?s:.*))\z
As a replacement pattern, you can use $1Моя_новая_строка$2
.
Details:
\A
- the beginning of the document((?:.*\R){2})
- Exciting group (submask) No. 1, which searches for 2 sequences of zero and more characters other than the newline character, followed by the newline character (the first two lines).*
- 0 or more characters other than a newline character (what will be replaced)((?s:.*))
- 2nd fascinating group that finds any 0 or more characters before ....\z
- the end of the document.
$1
- back link to the content of the 1st exciting subplay.