My replace all function is as below, it is in commonHelper.js file
exports.replaceAll = function (find, replace, str) {
return str.replace(new RegExp(find, 'g'), replace);
}
Then I do following
var commonHelper = require('./commonHelper');
var html_body = commonHelper.replaceAll('[[username]]', user_row.username, template_row.message_body);
html_body = commonHelper.replaceAll('[[forgot_pass_link]]', forgot_pass_link, html_body);
this is not properly replacing the [[key]] parts here. What should I change to fix this?