Question

I want to search and replace a lot of numbers in the range 0-9 and add one to them, so they become in the range 1-10 instead.

for example: 0 3 5

would become: 1 4 6

In eclipse Find/Replace window I can match a number with ^([0-9]+)$

In the replace-field can I somehow add to the matched number $1?

/G

Was it helpful?

Solution

No, there isn't a way to specify a callback function/macro, which is what you would need in order to change the first group ($1), or any of the results, in such a way.


Maybe there's a plugin that will enable this, but I'm not currently aware of one.


As a work-around, you could perhaps use jEdit for this, which does allow you to apply a script to your results (although I've not yet tried it myself so not sure how well it works).

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top