Javascript RegExp string pattern
<p>I need to check JS matches for a dynamically generated string.</p>

<p>ie.</p>

<pre><code>for(i=0; i&lt; arr.length; i++)
{
 pattern_1="/part of "+arr[i]+" string!/i";

 if( string.search(pattern_1) != -1)
  arr_num[i]++;

}
</code></pre>

<p>However, this code doesn't work - I presume due to the quotes. How do I do this?</p>

<p>Many thanks.</p>
