replace-column-values

Replaces values in source column with some or all matches of a pattern replaced by a replacement, or puts the modified values in a new column instead.

Search for values using a pattern (text or regular expression). If pattern is a text value, only the first occurrence in each value (column-row, cell) will be replaced. Replacement values are added to target column.

Note: within each value, only the first instance is replaced.

How is this adaptor different from "replace-value"? It allows you to create a new target column to hold the modified data, rather than simply replacing the values in the source column. However, it also only replaces the first instance of the pattern value.

Arguments

Inputs:

data: A datatable to be searched.

source: The name of a column in data to be searched.

pattern: A text or a regular expression to be replaced. Regular expressions must be wrapped with "/" character (e.g. /.*/). Note that within each value, only the first instance of each pattern will be replaced.

replacement: Text that replaces the substring specified by the specified pattern parameter.

target: The name of the column to which replacement values are added. If unspecified, defaults to source column.

Output:

data: A datatable with replacement text in place of pattern text, with target column added (or source column modified).

Last updated