My code only replaces the first match, ignoring the flags (global and multi line). What am I doing wrong?
for (var i = 0; i < values.length; i++) {
template = template.replace('{' + i + '}', values[i].toString().trim(), 'gm');
}
As you can see, my placeholders have this format: {0}, {1} etc
.replace()method doesn't accept regex modifiers. Maybe you meant to use theRegExpconstructor?