regex search using string
<p>I have a string of text that has the value of the selected text. Id like to do a replace() of this text in a given div of text.</p>

<p>so I know I can do that with the following:</p>

<p><code>myelement.replace(/foo/g, 'bar');</code></p>

<p>However I need to do it with my string ie:</p>

<p><code>myelement.replace(/*mystring*/g, 'bar');</code></p>

<p>So I tried:</p>

<pre><code>mystring = '/'+mystring+'/g';
myelement.replace(mystring, 'bar');
</code></pre>

<p>Which didnt work, so i tried (which i knew wouldn't work):</p>

<p><code>myelement.replace(/+mystring+/g, 'bar');</code></p>

<p>So how can i do this?</p>

<p>I've coded something up for you guys in jsfiddle --> <a href="http://jsfiddle.net/5DYZN/" rel="nofollow">HELP ME PLEASE!</a></p>
