Sublime Text 2 RegEx replace n with n+1

2019-06-23 05:46发布

问题:

Using RegEx search and replace with Sublime Text 2, how can I replace my pattern matches (n) with n+1? And if there is no way to do this with search and replace, is there another easy way to do it?

My RegEx pattern is ^(\d{1,4})\n, and I'd like to be able to do $1+1, which currently just outputs the match with a literal "+1".

回答1:

Regex is the wrong tool for that function. However, there is Sublime Text plugin just to do what you want: "Sublime Text plugin to increment/decrement all selected numbers"