title: replace the word or some characters in a word in html page with jquery
body: <p>I found the jquery code (I forgot the original site) is working to replace a word in a html page to be star sign (*), and the code is running well, but the code can only be used to replace each a single word, can't change the part of the word and also case-sensitive.</p>
  
  <p>JQuery code : </p>
  
  <pre><code>String.prototype.repeat = function(num){
    return new Array(num + 1).join(this);
  }
  
  /* Word or Character to be replace */
  var filter = ['itch','asshole', 'uck', 'sex'];
  $('body').text(function(i, txt){
    // iterate over all words
    for(var i=0; i&lt;filter.length; i++){
      // Create a regular expression and make it global
      var pattern = new RegExp('\\b' + filter[i] + '\\b', 'g');
      // Create a new string filled with '*'
      var replacement = '*'.repeat(filter[i].length);
      txt = txt.replace(pattern, replacement);
    }
    // returning txt will set the new text value for the current element
    return txt;
  });
  </code></pre>
  
  <p>word filter:</p>
  
  <pre><code> ['itch','asshole', 'uck', 'sex'];
  </code></pre>
  
  <p>and result :</p>
  
  <pre><code>sex -&gt; ***    // successfully replacing
  SEX -&gt; SEX    // not replaced, i want this word also replaced to ***
  bitch -&gt; bitch // not replaced, i want this word replaced to b****
  </code></pre>
  
  <p>how to modify this jquery code so that can be used to change some of the characters in the word and not case-sensitive?</p>
  
  <p>the fiddle : <a href="http://jsfiddle.net/bGhq8/" rel="nofollow">http://jsfiddle.net/bGhq8/</a></p>
  
  <p>Thank you.</p>