SEARCH AND REPLACE A PATTERN IN THE STRING

Performs a search-and-replace operation on the name (key) strings within a key-value collection. Supply a search pattern and a replacement string; optionally restrict substitution to a specific subset of keys. Use this worker to rename or sanitize keys in a key-value pair before passing them downstream.

When to use

Classification: process.

Tagged: keyvalue, pattern, process, rename, search_replace, string, transform.

Inputs

Label ID Type Default Required Description
Kv1 kv1 keyvalue   Input key-value collection whose key names will be subject to the search-and-replace operation.
search search scalar   String or regex pattern to search for within each key name; leave empty to skip replacement.
replace replace scalar   Replacement string that will substitute every match of the search pattern; leave empty to effectively delete matched substrings.
Replace Names replace_names text   Optional whitelist of key names (multi-select, drawn from kv1) to which the replacement is restricted; if omitted, all keys are processed.

Outputs

Label ID Type Description
keyvalue_replace_name_output_1 keyvalue_replace_name_output_1 keyvalue Updated key-value collection with the search pattern substituted by the replacement string in the specified (or all) key names.

Disciplines

  • data.dataset.transform

Runnable example

A runnable example is registered for this worker. Open the example workflow on the d3VIEW canvas: /api/workflow/example?id=keyvalue_replace_name


Auto-generated from transformation schema. Worker id: keyvalue_replace_name. Schema hash: 737d828524dc. Hand-curated docs in workerexamples/ override this page when present.