Javascript: Convert a String to Regular Expression
<p>I want to convert a string that looks like a regular expression...into a regular expression.</p>

<p>The reason I want to do this is because I am dynamically building a list of keywords to be used in a regular expression. For example, with file extensions I would be supplying a list of acceptable extensions that I want to include in the regex.</p>

<pre><code>var extList = ['jpg','gif','jpg'];

var exp = /^.*\.(extList)$/;
</code></pre>

<p>Thanks, any help is appreciated</p>
