title: How to use dynamic variable between regular expression
body: <p>I have string which contains some date and some comma separated values like this</p>
  
  <pre><code>var a = "1,13,20160308,200500000012016,10,Pending,01-02-2016,1|#|1,13,20160418,200500000012016,10,Pending,08-03-2016,1|#|1,13,20160623,200500000012016,10,Pending,18-04-2016,1|#|1,13,20160803,200500000012016,10,Pending,23-06-2016,1|#|1,13,20160912,200500000012016,10,Pending,03-08-2016,1|#|1,13,20161022,200500000012016,10,Pending,12-09-2016,1|#|1,13,20161129,200500000012016,10,Pending,22-10-2016,1|#|1,13,20170110,200500000012016,10,Pending,29-11-2016,1|#|1,13,20170215,200500000012016,10,Pending,10-01-2017,1|#|15-02-2017 APPEARANCE"
  </code></pre>
  
  <p><strong>regular expression:</strong> <code>/(.)*?01-02-2016(.)*?\|\#\|/igm</code>
  By using this regular expression i can able to delete unnecessary part in string.</p>
  
  <p>Now i want to change 03-08-3016 (date) dynamically. If i use 
  var date = "01-02-2016"
  var reg = <code>/(.)*?${date}(.)*?\|\#\|/igm</code>;</p>
  
  <p>If you pring reg in console.log you will get like this below
  <code>console.log(reg)</code> ----> <strong>output</strong>: '/(.)<em>?01-02-2016(.)</em>?|#|/igm'</p>
  
  <p>Expected Final output will delete  upto 01-02-2016,1|#| </p>