javascript casting a string of regex into a type object
<p>I have a box where the user inputs a regex, and in Javascript I take that value and have another string tested with it like so: (this is an abstraction of my real issue)</p>

<pre><code>var regex = $('input').val();
regex.test('some string');
</code></pre>

<p>The only way I know to make sure to cast the <code>regex</code> to a safe <code>Object</code> type, is to use <code>eval()</code>. </p>

<p>Is that the best way of casting it?</p>
