Suggestion to improve the script
<p>In the below script I am trying to highlight all the words in a sentence  </p>

<pre><code>function SearchQueue(text)
{  
    if(text !== null)
   {
    text = text.replace(/“/g, "\"");
    text = text.replace(/”/g, "\"");
    text = text.replace(/’/g, "\'");
    text = text.replace(/‘/g, "\'");
    text = text.replace(/–/g, "\-");
    text = text.replace(/ +(?= )/g,'');
    $.trim(text);
    text = text.replace(/\d\.\s+|[a-z]\)\s+|•\s+|[A-Z]\.\s+|[IVX]+\.\s+/g, "");
    text = text.replace(/([0-9A-Z]+[.)]|•)\s+/gi, "");
    text = text.replace(/(\r\n|\n|\r)/gm,"  ");
   }
   var words = text.split(' ');
   for(var i=0;i&lt;words.length;i++)
       $('*').highlight(''+words[i]+''); // Will highlight the script with background color
 }
</code></pre>

<p>But this is making my page "unresponsive". Please suggest me to improve the script...</p>
