title: How to dynamically create regex to use in .match Javascript?
body: <p>I need to dynamically create a regex to use in match function javascript.
  How would that be possible?</p>
  
  <pre><code>var p = "*|";
  var s = "|*";
  "*|1387461375|* hello *|sfa|* *|3135145|* test".match(/"p"(\d{3,})"s"/g)
  </code></pre>
  
  <p>this would be the right regex:    <code>/\*\|(\d{3,})\|\*/g</code></p>
  
  <p>even if I add backslashes to p and s it doesn't work. Is it possible?</p>