【问题标题】:Vim Regex to replace tagsVim 正则表达式替换标签
【发布时间】:2012-04-27 18:16:29
【问题描述】:

我正在寻找一个正则表达式来从文本文件中删除电子邮件地址。

输入文件:

Hannah Churchman <xxxx@xxxxxxxx.com>; Julie Drew <xxxx@xxxxxxxxx.com>;

输出文件:

Hannah Churchman; Julie Drew;

我认为像 s///g 这样的通用正则表达式会是一个很好的起点,但我无法找到适合使用 Vim 的表达式?

类似

:%s/ <\(.*?\)>//g

不起作用。错误是“E486:找不到模式:”。

:%s#[^ <]*>##g   almost works but it leaves  the space and < behind.
:%s# <##g  to remove the " <" remaining stuff.

关于如何更好地制作此命令的任何提示?

【问题讨论】:

标签: vim regex


【解决方案1】:

我在您的示例上尝试了这个正则表达式,它似乎有效::s/\s&lt;[^\&gt;]*&gt;//g

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2017-09-09
    • 1970-01-01
    • 1970-01-01
    • 2012-07-06
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多