String Replacer (Dictionary)

This node replaces strings in selected columns. The dictionary table provides the patterns to search for and the values to replace matches with. If no pattern matches, the result string equals the input string. You can choose to modify strings in-place or add the result strings in new columns.

Options

Target columns
Select the columns in which the strings should be replaced.
Pattern type
Select the type of pattern which you want to use.
  • Literal matches the pattern as is.
  • Wildcard matches * to zero or more arbitrary characters and matches ? to any single character.
  • Regular expression matches using the full functionality of Java regular expressions, including back references in the replacement text. See the Java API for details.
Use backslash as escape character
If checked, the backslash character can be used to escape special characters. For instance, \? will match the literal character ? instead of an arbitrary character. In order to match a backslash you need to escape the backslash, too (\).
Case sensitive
Specifies whether matching will distinguish between upper and lower case letters.
Pattern column
The column containing literal strings, wildcard patterns or regular expressions, depending on the pattern type selected above.
Replacement column
The column containing text that replaces the previous value in the cell if the pattern matched it. If you are using regular expressions, you may also use backreferences (e.g. $1 to refer to the first capture group, named capture groups can also be used with (?<group>) and ${group} to refer to them).
Replacement strategy
Select what to replace in case a string matches a pattern.
  • Whole string replaces the entire string with the replacement string, requiring an exact match of the whole string.
  • All occurrences replaces all occurrences of the pattern with the replacement string. Note that when e.g. matching on the RegEx-pattern .*, an empty string at the end of the input is also matched and replaced. To avoid that, use e.g. the pattern ^.* to indicate that the match has to start at the beginning of the string.
If multiple patterns match
Select the strategy to use if multiple patterns match.
  • Apply first matching only applies the first replacement that has a matching pattern.
  • Apply all sequentially applies all replacements with matching patterns from the dictionary table sequentially. This means that later patterns can also match the output of another replacement: For example, when the input is "A" and there are the replacements A -> B and B -> C, the resulting string is "C".
Append new columns
If enabled, the strings will not be replaced in-place but new columns are appended that contains the original string with the replacement applied.
Suffix for new columns
The suffix that is appended to the newly created columns with strings

Input Ports

Icon
The data table contains the string columns to perform the replacement on.
Icon
The dictionary table has a pattern column and a replacement column that will be used to perform the replacements

Output Ports

Icon
The dictionary table has a pattern column that defines what to search for and a replacement column that defines what to replace matches with.

Views

This node has no views

Workflows

Links

Developers

You want to see the source code for this node? Click the following button and we’ll use our super-powers to find it for you.