有什么方法可以在Notepad ++中将字符串添加到特定行的开头吗?
例如,我想向第23行添加一个字符串,然后转到新行。有可能吗?
编辑:
输入:
text 1
text 2
text 3
预期结果:
text 1
text 2
ADDED LINE
text 3
我知道我可以在其中复制并粘贴字符串,但是我必须对多个文件执行此操作。
答案 0 :(得分:0)
^(?:.+(\R)){23}
$0added line$1
. matches newline
说明:
^ : beginning of line
(?: : start non capture group
.+ : 1 or more any character but newline
(\R) : group 1, any kind of linebreak (ie. \r, \n, \r\n)
){23} : non capture group must appears 23 times
替换:
$0 : the whole match
added line : line to be added
$1 : content of group 1 (i.e. linebreak)