【问题标题】:In Notepad++ , how to replace with new line, every last occurrence of a pattern in a line?在 Notepad++ 中,如何用新行替换一行中最后一次出现的模式?
【发布时间】:2018-05-11 18:40:50
【问题描述】:

在 Notepad++ 中,如何用新行替换一行中最后出现的模式?

例如:

之前:

abc/acd/cd 
ac/sd
ace/edf/cd/cfd

之后:

abc/acd
cd
ac
sd
ace/edf/cd
cfd

类似于: Notepad++ insert new line at every nth occurrence of a string/character

【问题讨论】:

    标签: notepad++


    【解决方案1】:
    • Ctrl+H
    • 查找内容:^.+\K/
    • 替换为:\n\r\n
    • 检查环绕
    • 检查正则表达式
    • 请勿查看. matches newline
    • 全部替换

    说明:

    ^   : beginning of line
    .+  : 1 or more any character but newline
    \K  : forget all we have seen until this position
    /   : a slash
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2017-02-22
      • 2018-02-27
      • 2012-01-25
      • 2022-01-11
      • 1970-01-01
      • 2015-03-28
      • 1970-01-01
      相关资源
      最近更新 更多