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 Files tabFind 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 LF or windows CR+LF or 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 store EN in $2Replace 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 ENP.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:
http://docs.notepad-plus-plus.org/index.php/Regular_ExpressionsModern 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.htmlOther sites with valuable regular expression information include:
http://perldoc.perl.org/perlre.html http://www.regular-expressions.info http://www.rexegg.com