如何删除 Notepad++ 中的序列行?

如何删除 Notepad++ 中的序列行?

我有这条线

Apple   
Monkey
Orange
Lion
fruit
animal
Fish
Tiger
Rose
but 
in 
that 
case 
it 
will 
first 
delete 
the
instead 
of 
really 
looking 
for 
an 
odd 
line.
line 
your 
cursor 
is 
in, 
You 
could 
also 
check 
"wrap 
around",  
ons 
about 
computer 
software 
or 
computer
about
he
the
de 
details 
and 
share

我想删除行号:1,8,15,22,29,36,43,50

最终结果如下

Monkey
Orange
Lion
fruit
animal
Fish
Rose
but 
in 
that 
case 
it 
first 
delete 
the
instead 
of 
really 
for 
an 
odd 
line.
line 
your 
is 
in
You 
could 
also 
check 
around"
ons 
about 
computer 
software 
or 
about
he
the
de 
details 
and 
share

我怎样才能做到这一点?

答案1

重要提示:将光标定位在文件的最开头。

  • Ctrl+H
  • 找什么:^.+\R((?:.+\R){6})
  • 用。。。来代替:$1
  • 打钩 环绕
  • 选择 正则表达式
  • 取消勾选 . matches newline
  • Replace all

解释:

^           # beginning of line
.+          # 1 or more any character but newline
\R          # any kind of linebreak
(           # group 1
    (?:         # non capture group
        .+          # 1 or more any character but newline
        \R          # any kind of linebreak
    ){6}        # end group, must appear 6 times
)           # end group 1

截图(之前):

在此处输入图片描述

截图(之后):

在此处输入图片描述

相关内容