【发布时间】:2021-11-08 05:57:53
【问题描述】:
我有文字:
alpha/beta/gamma
alpbeta/gamma
alpha/beta/gamma
This is an example. Test1,Test2,Test3
alpha/beta/gamma
This is an example.
Test1,Test2,Test3
我想在斜线 (/) 之间的每个单词的末尾添加 *,但 vim 没有发现我的模式...
我的命令:
:%s/\/(.*?)\//*/g
我想要的结果:
alpha/beta*/gamma
alpbeta/gamma
alpha/beta*/gamma
This is an example. Test1,Test2,Test3
alpha/beta*/gamma
This is an example.
Test1,Test2,Test3
【问题讨论】:
-
那么,如果你的输入是
a/b c d/ee fff/ g hh/,你想得到a/b* c* d*/ee fff/ g* hh*/?能否请您详细说明一下要求? -
@WiktorStribiżew 我编辑了我的问题并添加了首选结果