title: Replace string value with javascript object
body: <p>I am currently making a small module for NodeJs. For which I need a small help.</p>
  
  <p>I will tell it like this.
  I have a variable with string. It contains a string html value. Now I need to replace <code>$(title)</code> something like this with my object <code>{ "title" : "my title" }</code>. This can be expanded to anything with user provide. This is current code.I think that I need RegEx for do this. Can you guys help me with this?</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>var html = `&lt;!DOCTYPE html&gt;
  &lt;html lang="en"&gt;
  &lt;head&gt;
    &lt;meta charset="UTF-8"&gt;
    &lt;title&gt;Document $(title)&lt;/title&gt;
  &lt;/head&gt;
  &lt;body&gt;
  
    &lt;h1&gt;Test file, $(text)&lt;/h1&gt;
  
  &lt;/body&gt;
  &lt;/html&gt;`;
  
  function replacer(html, replace) {
    // i need a regex to replace these data
    //return replacedData;
  }
  
  replacer(html, { "title" : "my title", "text" : "text is this" });</code></pre>
  </div>
  </div>
  </p>