This is working
newRow.replace('[[' + key + ']]', item);
but i tried replacing with regex but its not working
newRow.replace('/\[\[' + key + '\]\]/'g, item);
You need to use the RegExp constructor to use the string literal syntax.
newRow.replace(new RegExp('\\[\\[' + key + '\\]\\]', 'g'), item);
Also note that we needed to use \\ instead of \. This is because the \ has its own meaning in string literal syntax. Therefore to get a literal \ character in the string passed to the constructor, we need to escape it.