【问题标题】:how to replace text before the char < in every line in notepad++ using regex如何使用正则表达式替换notepad ++中每一行中char <之前的文本
【发布时间】:2017-05-16 09:31:54
【问题描述】:

在记事本++中我有很多行,有些行包含字符

我在这里找到了一个与答案非常相似的问题: How to replace all words before a particular character in a line in Notepad++
但我未能根据我的需要修改正则表达式。

在那个答案中,正则表达式 = ^[\w\s]+\=(.*)$ 所以我尝试将 = 替换为 ^[\w\s]+\<(.*)$ 但它不起作用。

这是文档中的一些示例数据:

test123@t-online.de
'hello' <hello@apollo.com

这是我想要的结果

test123@t-online.de
hello@apollo.com

【问题讨论】:

    标签: regex notepad++


    【解决方案1】:

    由于您需要替换直到 &lt; 的任何字符,您可以使用更简单的正则表达式:

    ^.*?<
    

    演示:https://regex101.com/r/MCO4Gg/2

    【讨论】:

      猜你喜欢
      • 2014-12-06
      • 1970-01-01
      • 2013-07-27
      • 1970-01-01
      • 1970-01-01
      • 2012-04-01
      • 1970-01-01
      • 2015-07-14
      • 2020-09-23
      相关资源
      最近更新 更多