如何删除文本到最后?

How to delete text to the end?

我有这样的组合

adrian-strauch@t-online.de:12xxxxxx | 5
svenschalke@t-online.de:kikerxxx | 33
dennis.meinhardt@t-online.de:vxxxxxx | 169
Fabibau@t-online.de:rofxxxx | 134
anders.gerd@t-online.de:townxxx | 1

我想删除最后 "x" 之后的文字以结束

我想我的组合有 60,000 行

我该怎么做?

我在记事本 ++ 中尝试了这个但不起作用

   use ctrl+h and type   " | /r "  

但它不起作用。

您可以匹配水平空白字符之间的竖线并匹配最后的数字直到字符串结尾。

Select 环绕正则表达式

查找内容:

\h+\|\h+\d+$

替换为

留空


说明

  • \h+ 匹配 1+ 个水平空白字符
  • \| 管道
  • \h+ 匹配 1+ 个水平空白字符
  • \d+ 匹配 1+ 个数字
  • $ 字符串结束

Regex demo


如果你也想匹配换行符,也可以是除了数字之外的其他东西:

\h+\|\h+.*\R*

Regex demo