Search results
25 lip 2024 · The replace() method of String values returns a new string with one, some, or all matches of a pattern replaced by a replacement. The pattern can be a string or a RegExp, and the replacement can be a string or a function called for each match.
- String
Strings can be created as primitives, from string literals,...
- String
18 lut 2022 · If you want to replace multiple characters you can call the String.prototype.replace() with the replacement argument being a function that gets called for each match. All you need is an object representing the character mapping that you will use in that function.
14 lis 2024 · Strings can be created as primitives, from string literals, or as objects, using the String() constructor: String primitives and string objects share many behaviors, but have other important differences and caveats. See "String primitives and String objects" below.
25 lip 2024 · These patterns are used with the exec() and test() methods of RegExp, and with the match(), matchAll(), replace(), replaceAll(), search(), and split() methods of String. This chapter describes JavaScript regular expressions. It provides a brief overview of each syntax element.
1 lip 2017 · The replace() method returns a new string with some or all matches of a pattern replaced by a replacement. The pattern can be a string or a RegExp, and the replacement can be a string or a function to be called for each match. Note: The original string will remain unchanged. A RegExp object or literal.
The replace() method returns a new string with some or all matches of a pattern replaced by a replacement. The pattern can be a string or a RegExp, and the replacement can be a string or a function to be called for each match. regexp (pattern) A RegExp object. The match is replaced by the return value of parameter #2. substr (pattern)
Return a new string where all "l" characters are replaced with "p" characters: Try it Yourself » The replace() method searches a string for a specified character, and returns a new string where the specified character (s) are replaced. Track your progress - it's free!