Facing issue with incrementing value in which i have to increment numerical string value.
var text = "SYN00099";
var getPart = text.replace(/[^\d.]/g, ''); // returns 00099
var num = parseInt(getPart); // returns 99
var newVal = num + 1; // returns 100
var reg = new RegExp(num.toString()); // create dynamic regexp
var newstring = text.replace(reg, newVal.toString()); // returns SYN000100
console.log(num);
console.log(newVal);
console.log(reg);
console.log(newstring);
this what i tried in my code. This works properly but the problem with this code it increase the string length if number going to increase. as example if it's last digit is 9 then it changes to 10 but it does not remove 1 zero from the string.