title: Is there a way to add code to each instance of a regex match on the fly?
body: <p>Let's say I have a block of text and I want to replace each instance of the word "the" with an indexed number.</p>
  
  <p>For example...</p>
  
  <p>"The great white shark is the father of bite theory."</p>
  
  <p>would become...</p>
  
  <p>"0 great white shark is 1 fa2r of bite 3ory."</p>
  
  <p>I'm looking for something like:
  myText.match(/the/gi).each(function(i){
   //?
  });</p>
  
  <p>jquery solutions welcome.</p>