title: How to put variable in regular expression match?
body: <p>I have the following snippet. I want to find the appearance of <code>a</code>, but it does not work. How can I put the variable right?</p>
  <pre><code>var string1 = 'asdgghjajakhakhdsadsafdgawerwweadf';
  var string2 = 'a';
  string1.match('/' + string2 + '/g').length;
  </code></pre>