how to replace the text with desired text in a para
<p>I have the following code.. in this I am trying to find the particular text and replace with desired one.. this is working fine if the string is in same case.. if we give with  capitals (like.. the as The) it is not giving out put.. so what is the solution for this.. can we use regular expressions in this  one..? please help me</p>

<pre><code>&lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD
HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd"&gt;
&lt;html&gt;  &lt;head&gt;   &lt;title&gt; New Document
&lt;/title&gt; &lt;script
type="text/javascript"
src="jquery-1.4.2.min.js"&gt;&lt;/script&gt;
&lt;script&gt; $(document).ready(function(){
$('#replace').click(function(){ var
oldstr=$('#inputstring').val(); var
newstr=$('#newstring').val(); var
para=$('#para').html();

var x=para.replace(oldstr,newstr);
$('#para').empty().html(x);

}) }) &lt;/script&gt;  &lt;/head&gt;

&lt;body&gt; Enter your string here:&lt;input
type="text" id="inputstring"&gt;&lt;br&gt;
Enter new string here:&lt;input
type="text" id="newstring"&gt;&lt;br&gt; &lt;input
type="button" id="replace"
value="Replace"&gt;&lt;br&gt;

&lt;p id="para"&gt;This is the new paragraph
written to test how to replace the a
string with desired string&lt;/p&gt; 
&lt;/body&gt; &lt;/html&gt;
</code></pre>
