js regex replace multiple words
<p>I need to replace ${conferance name} with ABC, ${conference day} with Monday in the following sentence.
Could some one help me with the regex.</p>

<pre><code>var text = "&lt;td&gt;${conference name}&lt;/td&gt;&lt;td&gt;${conference day}&lt;/td&gt;"

var list = ["${conferance name}", "${conference day}" ]

for (var j = 1; j &lt; list.length; j++) {
            //Extracting the col name
            var colName  =   list[j].split("${");
            colName = colName.split("}")[0];
            //Replacing the col name
            text = text.replace(new RegExp('\\$\\{' + colName + '\\}', 'g'), "ABC");

        }
</code></pre>

<p>The above code repalces fine if i have ${conference_name}, but it fails when i have a space in between.</p>

<p>The list is a dynamic array. And the Replace texts are also dynamic. I just simulated them as objects here for fitting them in the Regex Statement.</p>

<p>Thanks in Advance.</p>
