正则表达式删除具有一定数量点的行?

red*_*nua 1 regex notepad++ line match

我想删除具有 3 个或更多点的行。我尝试自己删除它,但它会删除所有带点的行,而我只需要包含 3 个或更多点的行。

例如

p..z.e.4c.e.u.j abc1
aaaaaa 11111
ju.as.h.e.s 125.60.000.
p.iv.p.f.j abcde
r.g.9c 11111112
o.u.n.ggz 12..345.6
ffffffff 22222
1.2.3.45 abcddd
ddddddddddd 33333333

to this result

aaaaaa 11111
r.g.9c 11111112
ffffffff 22222
ddddddddddd 33333333
Run Code Online (Sandbox Code Playgroud)

Tot*_*oto 5

  • Ctrl+H
  • 找什么:^.*(?:\..*?){3}.*(?:\R|\Z)
  • 用。。。来代替:LEAVE EMPTY
  • 检查 环绕
  • 检查 正则表达式
  • 取消选中 . matches newline
  • Replace all

解释:

^               # beginning of line
  .*            # 0 or more any character but newline
  (?:           # non capture group
    \.          # a dot
    .*?         # 0 or more any character but newline, not greedy
  ){3}          # end group, must appear 3 times
  .*            # 0 or more any character but newline
(?:\R|\Z)       # non capture group, any kind of linebreak OR end of file
Run Code Online (Sandbox Code Playgroud)

屏幕截图(之前):

在此输入图像描述

屏幕截图(之后):

在此输入图像描述