title: Extract parameters in an string an replace them with their values which are in another map with regular expression in javascript
body: <p>I have a map like this:  </p>
  
  <p><code>var params = { 'name':'Mehran', 'city':'Isfahan'};</code></p>
  
  <p>and I also have a string like this:  </p>
  
  <p><code>var welcomeText = 'Hi {{name}}! {{city}} is a beautiful city.';</code></p>
  
  <p>My purpose is to replace the <code>{{name}}</code> and <code>{{city}}</code> with their values in <code>params</code> with a <code>render()</code> function.  </p>
  
  <p><code>var result = render(welcomeText, params);</code></p>
  
  <p>And the <code>result</code> would be something like this:  </p>
  
  <p><code>'Hi Mehran! Isfahan is a beautiful city.'</code></p>