This example replaces the word "wordone" with the word "wordtwo".
document.replaceAll("wordone","wordtwo",true)
Related information
replaceAll method