Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
516 views
in Technique[技术] by (71.8m points)

vim 中查找不以 ab 结尾的行

我用的是 /[^a][^b]$,但 [^b] 似乎没起作用:只要一行倒数第 2 个字符是 a,就没有被 vim 匹配——我的正则出了什么问题?


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

写法明显有问题吧,你这样写的意思是:倒数第一个不是b,倒数第二个不是a的所有行。
没用vim,试了一下这个应该是可以的/^.*(?<!ab)$/


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...