I want to split a string, such as this:
"Hello %id:1%, how are you %id:2% etc...",
but “%id:Int%” should not be split:
const test = [
"%id:1%",
"%id:2%",
"%id:3%"
]
let str = "test %id:1%!";
str = str.split("");
// wanted result: ["t", "e", "s", "t", " ", "%id:1%", "!"];
// actual result: ["t", "e", "s", "t", " ", "%", "i", "d", ":", "1", "%", "!"]
This would take anything from the “test” array and not split it with every sepparate character.