I have a string that need to be split with a regular expression for applying some modifications.
eg:
const str = \"Hello+Beautiful#World\";
const spl
you can rejoin the array by finding the indexes that where the matching happened on the string
const str = "Hello+Beautiful#World";
const regex = /[\+#]/g;
const splited = str.split(regex);
console.log(splited);
//join
let x = '';
let i=0;
while ((match = regex.exec(str)) != null) {
x = x + splited[i] + "00" + (i+1) + str[match.index];
i++;
}
x = x + splited[splited.length-1] + "00" + (i+1);
console.log(x);