Find and Replace with String or RegEx
January 2022
The simplest replacement is substituting one string for another with `.replaceAll()`
const original = "the quick brown fox"
const updated = original.
Output:
the quick green fox
This can also be done with a regular expression
TODO: See also: .replace() which only does one
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 = /\d+s/g
const original = "There are 1000s and 1000s of corgis"
const updated = original.
Output:
There are lots and lots of corgis
More here: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/replace
end of line