Better way to replace a text pattern?

Better way to replace a text pattern?

Assume on a web page there are text strings with the pattern "aaa bbb ccc" (without double quotes).

I want to replace them by a blank or even with nothing (=empty string).


Until now I used the following javascript commands to accomplish this:

var content=document.body.innerHTML;
newContent=content.replace(/aaa bbb ccc/g,' ');
document.body.innerHTML=newContent;


Is there a better way with jQuery to do this?


Is there a way to restrict the replacement to only <ul>......</ul> elements resp. their inner content?


Thank you

Peter