vim regex 将所有数字加 1 [英] vim regex increment all numbers by 1
本文介绍了vim regex 将所有数字加 1的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在 java 中有一个准备好的语句,我在前面添加了一个参数.长话短说,我必须使用大量 set 方法并将它们的第一个参数加 1.
I have a prepared statement in java that i am adding an argument to the front of. Long story short, I have to take a ton of set methods and increment their first argument by 1.
我想要一种快速搜索和替换匹配所有数字的方法,然后将它们加一.
I'd like a quick way to do a search and replace matching all numbers, and then increment them by one.
推荐答案
想通了.
%s/\d\+/\=(submatch(0)+1)/g
http://vim.wikia.com/wiki/Using_an_expression_in_substitute_command
这篇关于vim regex 将所有数字加 1的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文