Is there a way to perform a search some HTML and whenever it finds an occurrence of a regular expression, wrap it in a span?
For example:
<p>The rain in Spain stays mainly on the plain</p>
$('p').match('/ain/gi').each(function() {
$(this).wrap('<span class="red"></span>');
});