var metin = "baris";
var icerikoku = "Hello Baris. What is surname Baris. Bye bye baris. How are you metin.";
var n = icerikoku.replace(/metin/gi, "ziya");
$("#icerikoku").html(n);
印刷:
Hello Baris. What is surname Baris. Bye bye baris. How are you ziya.
ただし、次のようにする必要があります。
Hello ziya. What is surname ziya. Bye bye ziya. How are you metin.