试试:
function rplc(str, text) {
return text.replace(new RegExp(str.replace(/[\\$()\[\]+.*?:<>\^]/g, "\\$+"), "g"), "AAA");
}var str = document.form0.searchS.value;
var text = document.form1.text.value;
document.form1.text.value = rplc(str, text);
function rplc(str, text) {
return text.replace(new RegExp(str.replace(/[\\$()\[\]+.*?:<>\^]/g, "\\$+"), "g"), "AAA");
}var str = document.form0.searchS.value;
var text = document.form1.text.value;
document.form1.text.value = rplc(str, text);
var str = document.form0.searchS.value;
var text = document.form1.text.value;
document.form1.text.value = text.split(str).join("[AAA]");