The strReplace() method returns a new string with one, some, or all matches of a pattern replaced by a replacement.
The string value to search and replace within.
The value to search for. Can be a string or regular expression.
The replacement string or replacer function.
A new string with one, some, or all matches replaced.
0.14.0
strReplace("a-b-a", "a", "x"); // "x-b-a"strReplace("a1b2", /\d/g, "#"); // "a#b#"strReplace("hello", /[aeiou]/, "*"); // "h*llo" Copy
strReplace("a-b-a", "a", "x"); // "x-b-a"strReplace("a1b2", /\d/g, "#"); // "a#b#"strReplace("hello", /[aeiou]/, "*"); // "h*llo"
The strReplace() method returns a new string with one, some, or all matches of a pattern replaced by a replacement.