I have two jQuery plugins that do something like this. One highlights (highlight) search text, the other one turns words on a page into wiki links (wikify). If you are interested, you can find them here: