I have this code:
array (\'id\' => 1, \'name\' => \"Murka\", \'date_of_birth\' => \"2014-10-31\", \"breed_id\" => 1), array (\'id\' => 1, \'na
I don't have an answer to your general question, but I do have one for your specific situation. You can make your command work by putting the comma into a positive look-ahead, like this:
:let i=1 | g/1(\,\)\@=/ s//\=i/ | let i+=1
Now it will only replace the 1.
1