Using variable in a regex
<p>say i have the following variables:</p>

<pre><code>myId; //Email_PDF
currentHoverOnItem; //Email_PDF_english of Email_PDF_Dutch or ...
</code></pre>

<p>So the first value is "Email_PDF" and the second is "Email_PDF_english". What i want i when currentHoverOnItem contains myId, then something can be executed.
This is what i have so far:</p>

<pre><code>var pattern = new RegExp("^/"+myId+"/$");

if (currentHoverOnItem.match(pattern))
{
    //Do something
}
</code></pre>

<p>Is this the right way to use the regex? It should match part of the string, there can be text before or after the match.</p>
