1

我有一个这样的文本文件:

This is sentence 1: text I don't need
This is sentence 2? text I don't need
This is sentence 3? text I don't need
This is sentence 4: text I don't need

我知道可以做%s/[:\|?].*/:例如替换之后的:所有内容?:

是否可以分别替换后面和:后面的所有内容? 我试过了,它不起作用?:?
%s/[:\|?].*/:\|?

4

1 回答 1

0
:%s/\d\+.\zs.*//g

使用 \zs vim 将使用替换数字后的所有内容,请参阅 :h \zs

于 2017-01-15T17:20:52.710 回答