Hello, @kracovwolf, @alan-kilborn and All,
The solution, provided by @alan-kilborn which uses the Extended search mode is really valuable !
In fact, except in very rare cases, the syntaxes of the replacement part : Line1\r\nLine 2\r\nLine3\r\nLine4\r\n... will preserved the syntax of each line !
BTW, if you’re usually deal with UNIX files ( see on the right part of the status bar ), you’ll have to change the REPLACE part as below :
Line1\nLine 2\nLine3\nLine4\n...
For example, from this INPUT text :
ab$cD^E\Fg-h()iIJ[]K:LOpen the Replace dialog ( Ctrl + H )
Unckeck all box options
SEARCH ab$cD^E\Fg-h()iIJ[]K:L
REPLACE ab$c\r\nD^E\F\r\ng-h()i\r\nJ[]K:L
Check the Wrap around option
Select the Extended ( \n, \r, \t, \0, \x... search mode
Click on the Replace All button
=> You get the expected OUTPUT text :
ab$c D^E\F g-h()i J[]K:LIn these others posts, below, I imagined a way to insert a multi-lines text, using the Regular expression search mode :
https://community.notepad-plus-plus.org/post/97866
https://community.notepad-plus-plus.org/post/97904
However, now I see that the Extended search mode or, even better, the Normal mode could drastically simplify the method when applied to a single file !
So, when you want to insert a multi-lines text, even in several locations, of the current file, just follow this method :
Let’s suppose that this INPUT text, below, is the text to be inserted : ------------- Inserted Multi-lines Text -------------First, paste the text to be inserted in a new tab
Select this multi-lines text without its last line-break ( so the line-break after the series of dashes )
Open the Replace dialog ( Ctrl + H )
=> The multi-lines text should be copied in the Find what: zone
Now, let’s switch to this text, in an other tab, which is the main text : bla blah ¤ bla blah <test>¤</test> blah bla Begin ¤ blah bla blah ¤ endNote that I use the ¤ symbol as an insertion symbol !
Click on the ⮁ symbol, of the replace dialog, in order to swap the Find what and Replace with zones=> The multi-lines text has moved into the Replace with : zone
Insert a single ¤ symbol in the Find what : zone
Unchek all the box options
Check the Wrap around option
Select the Normal search mode ( No need to choose the Extended mode )
Click on the Replace All button
=> The ¤ should have been replaced by the multi-lines text in four locations and you get the following OUTPUT text :
bla blah ------------- Inserted Multi-lines Text ------------- bla blah <test>------------- Inserted Multi-lines Text -------------</test> blah bla Begin ------------- Inserted Multi-lines Text ------------- blah bla blah ------------- Inserted Multi-lines Text ------------- endBest Regards,
guy038