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

Regex to delete lines with a certain amount of dots?

我想删除包含 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
  • Ctrl+H
  • 查找内容:^.*(?:\..*?){3}.*(?:\R|\Z)
  • 替换为:LEAVE EMPTY
  • 检查 环绕
  • 检查 正则表达式
  • 取消选中 . matches newline
  • 全部替换

解释:

^               # 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

屏幕截图(之前):

屏幕截图(之后):