title: Replacing string in regex with variable in javascript
body: <p>I'm looking to replace string with variable in regex.</p>
  
  <pre><code>re = new RegExp(/(?:^|\b)(asd)(?=\b|$)/, 'g')
  </code></pre>
  
  <p>After i get <code>re</code> i replace it and it works but this is limited to <code>asd</code> string. </p>
  
  <p>How can i put variable <code>d</code> in place of <code>asd</code> string?
  I tried following:</p>
  
  <pre><code>re = new RegExp('(?:^|\b)(' + d + ')(?=\b|$)', 'g')
  </code></pre>
  
  <p>But it didn't work, any help is appreciated. (I'm Using CoffeeScript)</p>