However, I do get extra points if I can do it one line of code. Just to be clear I would have to replace two different words with two different new words that are in one long line of text.
Is using regex a requirement here? You can do this simply by chaining replace
or replaceAll
calls since the return the updated result string. Also, when you say single line, does it mean just one regex (and the supporting helper code) or literally a single line?