• Replaces text in a string, using a regular expression or search string.

    Parameters

    • searchValue: string | RegExp

      A string or regular expression to search for.

    • replaceValue: string

      A string containing the text to replace. When the searchValue is a RegExp, all matches are replaced if the g flag is set (or only those matches at the beginning, if the y flag is also present). Otherwise, only the first match of searchValue is replaced.

    Returns string

  • Replaces text in a string, using a regular expression or search string.

    Parameters

    • searchValue: string | RegExp

      A string to search for.

    • replacer: ((substring, ...args) => string)

      A function that returns the replacement text.

        • (substring, ...args): string
        • Parameters

          • substring: string
          • Rest ...args: any[]

          Returns string

    Returns string

  • Passes a string and replaceValue to the [Symbol.replace] method on searchValue. This method is expected to implement its own replacement algorithm.

    Parameters

    • searchValue: {
          [replace](string, replaceValue): string;
      }

      An object that supports searching for and replacing matches within a string.

      • [replace]:function
        • Parameters

          • string: string
          • replaceValue: string

          Returns string

    • replaceValue: string

      The replacement text.

    Returns string

  • Replaces text in a string, using an object that supports replacement within a string.

    Parameters

    • searchValue: {
          [replace](string, replacer): string;
      }

      A object can search for and replace matches within a string.

      • [replace]:function
        • Parameters

          • string: string
          • replacer: ((substring, ...args) => string)
              • (substring, ...args): string
              • Parameters

                • substring: string
                • Rest ...args: any[]

                Returns string

          Returns string

    • replacer: ((substring, ...args) => string)

      A function that returns the replacement text.

        • (substring, ...args): string
        • Parameters

          • substring: string
          • Rest ...args: any[]

          Returns string

    Returns string

Generated using TypeDoc