var x='test[0]'; var y=x.replace(/(\d+)/,'$1'*1+1); console.log (x + " : "+ y);
var x='test[0]'; var y=x.replace(/(\d+)/,(p0, p1) => +p1+1); console.log (x + " : "+ y);