var regexp = new RegExp("/&&-img_1-&&/g");
console.log('&&-img_1-&&'.replace(regexp, "img")); // &&-img_1-&&
var regexp = new RegExp(/&&-img_1-&&/g);
console.log('&&-img_1-&&'.replace(regexp, 'img'));
var myNumber = 2;
var myVar = '&&-img_' + myNumber + '-&&';
var regexp = new RegExp(myVar, 'g');
console.log('&&-img_2-&&'.replace(regexp, 'img'));
var regexp = new RegExp(/&&-img_\d-&&/g);