Is this not a little duplicate of the question Highlight a word with jQuery ?
Something like the JQuery search highlight plugin could be helpful
Or, as pointed out in the same question, write your own jquery function:
Something like (untested code, feel free to edit):
jQuery.fn.addSpan = function (elName, str, offset, length)
{
if(this.innerHTML = str)
{
return this.each(function ()
{
this.innerHTML = this.innerHTML.substring(0,offset) + "<span>" + this.innerHTML.substring(offset, offset+length) + "</span>" + this.innerHTML.substring(offset+length));
});
}
};
And you would use it like so:
$("p").addSpan("one two three four", 4, 9);