Copy and Replace
- 
 Hi! I have multiple files that I would like to change using a find and replace function. Each file has different text on line 5, and ‘EN’ as the last line. I would like to find a way to copy Line 5 and paste within a new text statement everytime it states ‘EN’ on multiple files without entering each one. Example: 
 Line 1
 Line 2
 Line 3
 Line 4
 1234
 ENReplace with : 
 Line 1
 Line 2
 Line 3
 Line 4
 1234
 New text 1234
 ENIs there a way to do this without going into each file? 
- 
 Your spec is rather ambiguous, but I think this will do what you asked for (in that it mimics the output): - Find what : (?-s)^(.*$\R)^(EN)$
- Replace with : $1New text $1$2
- ☑ Regular Expression
- Make sure you’re on the Find in Filestab
 Find details: - (?-s)= make sure- .does not match EOL characters (this will ensure that the next parenthetical will only match one line’s worth
- ()= Everything inside parentheses gets put into the next- $#variable
- ^= matches the beginning of a line
- $= matches the end of a line
- \R= matches the EOL character sequence (whether it’s a linux- LFor windows- CR+- LFor old mac- CR)
- ^(.*$\R)= combining concepts above: match all the text between the start and end of line, plus the EOL sequence, and store it all in- $1
- ^(EN)$ = match the entire line matching EN, and storeENin$2
 Replace details: - $1: quote the values in- $1, so it will be the fifth line and its new-line sequence
- new text $1: add “New text”, followed by a space and the full contents of the fifth line (including its newline)
- $2: quote the- EN
 
 P.S. : 
 (paraphrasing @guy038, the forum’s regex guru, who compiled these great regex resources, but hasn’t shared them in this thread yet):Here is a good starting point for NPP users unfamiliar with regular expression concepts and syntax: Modern Notepad++ (since v6.0) uses the Boost C++ Regex library, v1.55.0 (similar to the Perl Regular Common Expressions (PRCE), v5.8): - search syntax: http://www.boost.org/doc/libs/1_55_0/libs/regex/doc/html/boost_regex/syntax/perl_syntax.html
- replace syntax: http://www.boost.org/doc/libs/1_55_0/libs/regex/doc/html/boost_regex/format/boost_format_syntax.html
 Other sites with valuable regular expression information include: 
- Find what : 
