I have a string in this format
"{{abc}}, {{def}}, some text {{ghi}}, some other text {{jkl}}"
And I would like to replace each of {{...}} with some string based on what is ... (that comes out of json and not an issue) and stuck with what regex pattern to use. Closest I could come was to /{{(.*)}}/gi, but that returns the whole string as the same has {{ and }} at ends. Here's the code I have tried
let str = "{{abc}}, {{def}}, some text {{ghi}}, some other text {{jkl}}";
let regex = /{{(.*)}}/gi;
let result;
let indices = [];
let results = [];
while ((result = regex.exec(str))) {
indices.push(result.index);
results.push(result[0]);
}
Any help will be highly appreciated
{/}. i.e.\{\{(.*)\}\}.*?, i.e.\{\{(.*?)\}\}