numberssublimetext2increment

Sublime Text 2 increment numbers


I have a JSON file that looks like this:

    "Algeriet" :
    [
        {
            "name" : "Nyårsdagen",
            "date" : "2013-01-01",
            "ID" : "1"
        },
        {
            "name" : "Mawlid En Nabaoui Echarif",
            "date" : "2013-01-24",
            "ID" : "2"
        },
        {
            "name" : "Första maj",
            "date" : "2013-05-01",
            "ID" : "3"
        },
       ...
     ]

Now I would like to begin incrementing the IDs from 0 instead of 1. How can I do this with Sublime Text 2? I have installed the Text Pastry plugin but I'm not sure how to select the IDs in the text so that I can replace these values.


Solution

  • Solved it by doing these steps:

    1. Do a find and replace for regex "ID" : "\d+" and replacing it with a string which I know does not exist anywhere in the file (I replaced it with "ID" : "xyz"
    2. Make a multiple selection on "ID" : "xyz"
    3. Using the Text Pastry plugin "Number Sequence (\i)" on the multiple selection