Trying to make me think of some regex using JS.replace to replace an integer with a string.
For example, a string might be:
var string = 'image[testing][hello][0][welcome]';
I want to replace "0" with another value. I originally used this:
string.replace( /\[\d\]/g, '[newvalue]');
But when we start replacing double digits or more (12, 200, 3204, you understand what I mean), it stops working normally. Not sure how to make it work the way I want it.
Thanks in advance. Very much appreciated.
source share