JSFiddle - React, Tailwind, and code Playground
by marenek
JavaScript
// http://stackoverflow.com/questions/11377930/increment-numbers-in-a-textarea-using-a-regexp
// první číslo v hranaté závorce bude inkrementováno
var str="pred_cislem[5]za_cilem[0]konec";
x = str.replace(/\[(\d+)(?=\].*)/, function(full_match, i) {
return '[' + ++i;
});
alert( 'vstup: ' + str + '\nvýstup: ' + x );