codice:
var re=new RegExp();
re.compile(variabile,"g");
str=str.replace(re,"pluto");
dove variabile contiene il testo da cercare