Edit: Should have said, this is for a Greasemonkey script, so it's basically to highlight a number of key phrases on a specific set of HTML pages. Thanks
This code highlights "First Phrase" in yellow:
document.body.innerHTML= document.body.innerHTML.replace(/First Phrase/g, function(m){
return '<span style="background-color:yellow">'+m+'</span>';
});
But how can I highlight multiple phrases in different colours, e.g. "Second Phrase" in red, "Third Phrase" in blue, and so on.
Thanks