BenjaminRH
BenjaminRH

Reputation: 12172

Sublime Text 2 RegEx replace n with n+1

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".

Upvotes: 6

Views: 6598

Answers (1)

Andrew Cheong
Andrew Cheong

Reputation: 30273

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"

Upvotes: 7

Related Questions