如何在记事本++中删除竖线以外的所有内容

时间:2018-12-13 17:40:03

标签: notepad++

例如:

“ Duden | wandeln | Rechtschreibung,Bedeutung,定义| entsenden | Rechtschreibung,Bedeutung(...)”

收件人:

“ wandeln 热情”

谢谢。

2 个答案:

答案 0 :(得分:0)

使用notepad ++正则表达式

Find: ([^\|]+)?\|([^\|]+)\|([^\|]+)
Replace: $2

答案 1 :(得分:0)

  • Ctrl + H
  • 查找内容:^.+?\|\h*(.+?)\h*\|.+?\|\h*(.+?)\h*\|.*$
  • 替换为:$1 $2
  • 检查环绕
  • 检查正则表达式
  • 取消检查. matches newline
  • 全部替换

说明:

^           # beginning of line
  .+?       # 1 or more any character, not greedy
  \|        # 1 pipe character
  \h*       # 0 or more horizontal spaces
  (.+?)     # group 1, 1 or more any character, not greedy
  \h*       # 0 or more horizontal spaces
  \|        # 1 pipe character
  .+?       # 1 or more any character, not greedy
  \|        # 1 pipe character
  \h*       # 0 or more horizontal spaces
  (.+?)     # group 2, 1 or more any character, not greedy
  \h*       # 0 or more horizontal spaces
  \|        # 1 pipe character
  .*        # 0 or more any character
$           # end of line

替换:

$1          : content of group 1
            : 1 space
$2          : content of group 2

给定示例的结果

wandeln entsenden
相关问题