You can either go down the DOM recursively by looking at the textContent or innerText property (if necessary), or you can use a loop over the collection returned by getElementsByTagName. In any case, once you have defined the text and the parent element, you need to figure out how to replace it.
What are your requirements for the structure of the document in the replacement if the string is split into one or more othere elements?
source share