Find and Replace with String or RegEx

January - 2022

TODO: See also: .replaceAll()

This is an example using a regex. You can also use a string. TKTKTK make more examples including ones with functions and strings

const regex = /fox/i
const initialString = "The quick brown fox"
const newString = initialString.replace(regex, 'cat')



The quick brown cat

More here: