It will replace matches for the searchValue in the string with the replaceValue.
searchValue
string
replaceValue
1.0.0
replace("Hi Fred, I'm Fred!", "Fred", "Barney");// => "Hi Barney, I'm Fred!" Copy
replace("Hi Fred, I'm Fred!", "Fred", "Barney");// => "Hi Barney, I'm Fred!"
replace("Hi Fred, I'm Fred too!", "Fred", "Barney", true);// => "Hi Barney, I'm Barney too!" Copy
replace("Hi Fred, I'm Fred too!", "Fred", "Barney", true);// => "Hi Barney, I'm Barney too!"
It will replace matches for the
searchValue
in thestring
with thereplaceValue
.