title: How can i search and replace strings in Node JS
body: <p>I am trying to write some code which allows me to pass a doc as a string which is either plain txt or html and has some fields embeded i want to replace with personal values. something like for example like this</p>
  
  <pre><code>Hi {{ first_name | fallback: "there" }},
  </code></pre>
  
  <p>i will pass the field names as an object with same name so the lookup is easy. So what i am looking for coding ideas how to search for the {{ }} part and then check if field is not unknown, null or "" and if it is apply the fallback value in the tag. 
  This is something like mailmerge but i dont want ths to be a docx file and output as word or pdf. i just want the processed string so i can pass back to my mail code and send message </p>