JSFiddle - React, Tailwind, and code Playground

by Brett Gaynor

JavaScript

var str= 'BUY [[Manufacturer]] [[Name]] cheap or get other [[Categories]] from [[Storename]] <i class="fa fa-check"></i> Thousands of satisfied customers.';
var res = str.match(/\[\[.*?\]\]/gm);
var placeholder_string = str.replace(/\[\[.*?\]\]/gm,"|");

const revert_string = placeholder_string.replace(/\|/g, () => {
  return res.shift();
});

console.log(str);
console.log(res);
console.log(placeholder_string);

console.log(revert_string);