2012-04-16 45 views
0

我正在尋找正則表達式來從文本文件中刪除電子郵件地址。Vim正則表達式來替換標籤

輸入文件:

Hannah Churchman <[email protected]>; Julie Drew <[email protected]>; 

輸出文件:(。*?)

Hannah Churchman; Julie Drew; 

我想到了一個通用的正則表達式shuch爲S/<> // g ^將是一個很好的起點,但我無法找到使用Vim的正確表達式?

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

不起作用。錯誤是「E486:找不到模式:」。

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

有關如何更好地製作此命令的任何提示?

+0

'*'是不是在VIM非貪婪的比賽,看到http://stackoverflow.com/a/1305957/155299 – 2012-04-16 15:16:07

回答

1

我想你的樣品這個表達式,它似乎工作:?:s/\s<[^\>]*>//g