The following string represents a viewmodel property and in this case it has 3 different indices:
PROGRAMA_FASES[1].PROGRAMA_FASE_REPLICAS[0].PROGRAMA_FASES.PROGRAMA_PREGUNTAS[2].Value
I'm using these functions to increase the first index or the last one.
function increment_last(v) {
return v.replace(/[0-9]+(?!.*[0-9])/, function (match) {
return parseInt(match, 10) + 1;
});
}
function increment_first(v) {
return v.replace(/(\d+)/, function (match) {
return parseInt(match, 10) + 1;
});
}
... as you can see i'm using regex to match the number before increasing it.
Can you help me with a regex that matches only the index on the middle? In this case it would be the "0".
Thanks a lot