replace

This block is part of the value group and was last modified in core v10.4.28.

replace v10.4.28

Returns a new value with one, some, or all matches of a pattern replaced by a replacement

In pins 3
  • Value required
    value
  • pattern required
    value

    A value to be replaced or a regular expression pattern, prefixed with flags (g, i, m)

  • replacement required
    value

    Replace the substring matched by pattern

Out pins 1
  • Value
    value

When substr is not of the form /pattern/flags it is a literal, case-SENSITIVE search and only the FIRST occurrence is replaced. A /pattern/flags value runs as a JS-style regex; ALL occurrences are replaced only with the g flag. A leading slash without a closing slash plus valid flag letters (e.g. the path "/api/v1") is treated as a literal, and an invalid regex outputs the input unchanged.

A typical wiring for replace: value feeds the value pin; convert to uppercase feeds the substr pin; the value out pin feeds substring.

Studio canvas example for the replace block: typical wiring for replace.

Commonly used with

In production blueprints, this block is most often wired together with:

  • value: feeds into this block. Simply returns the provided value.
  • replace: wired in both directions with this block. Returns a new value with one, some, or all matches of a pattern replaced by a replacement.
  • fields: this block feeds into it.
  • substring: this block feeds into it.
  • convert to uppercase: feeds into this block.
  • set fields: this block feeds into it. Generates an array of mutations based on the given filled fields.

Version history

Introduced in v10.4.28.


Back to value Return to the main group to view all sub-groups Back to value Return to the group to view all blocks within this group