Regex 删除第二个和第三个冒号之间的文本

Regex 删除第二个和第三个冒号之间的文本,regex,notepad++,Regex,Notepad++,我有这样的台词: example1:example2:example3 example1:exa5:exa8 我想把它们转换成 example1:example3 example1:exa8 用正则表达式可以做到这一点吗 任何帮助都将不胜感激 谢谢 在中查找使用的内容: (?<=:)[a-z0-9]+: (? Ctrl+H 查找内容::[^:\r\n]+(?=:) 替换为:留空 检查环绕 检查正则表达式 全部替换 说明: : # a colon [^:\r\n]

我有这样的台词:

example1:example2:example3
example1:exa5:exa8
我想把它们转换成

example1:example3
example1:exa8
用正则表达式可以做到这一点吗

任何帮助都将不胜感激


谢谢

中查找使用的内容:

(?<=:)[a-z0-9]+:
(?
  • Ctrl+H
  • 查找内容:
    :[^:\r\n]+(?=:)
  • 替换为:
    留空
  • 检查环绕
  • 检查正则表达式
  • 全部替换
说明:

:           # a colon
[^:\r\n]+   # 1 or more any character that is not a colon or line break
(?=:)       # positive lookahead, make sure we have a colon after
example1:example3
example1:exa8
给定示例的结果:

:           # a colon
[^:\r\n]+   # 1 or more any character that is not a colon or line break
(?=:)       # positive lookahead, make sure we have a colon after
example1:example3
example1:exa8

为什么否决?为什么这个问题太宽泛了?@UnderrableLightness在所有评论被删除之前,我在回答中给出了相同的原因:+我知道了,我已经看到许多带有正则表达式标签的问题,与这个问题的格式相同,它们仍然是开放的…@UnderrableLightness那么它们应该是封闭的。我会记住这一点,并与你一起报告它们我没有回答这个问题。