Renames all columns based on a regular expression search & replace pattern. The search pattern is a regular expression, and can possibly contain groups for further back referencing in the replace field.
In the simplest case, you can search and replace string literals. E.g. if the input columns are called "Foo 1", "Foo 2", "Foo 3", etc and the search string is "Foo", the replacement is "Bar", the output will be "Bar 1", "Bar 2", "Bar 3".
More complicated cases contain
capturing groups,
i.e. expressions in parentheses that, if matched in a column name, are saved. The groups can be
referenced in the replacement string using $g
, whereby g
is a number 0-9.
These placeholder will be replaced by the original occurrence in the input column name.
For instance, to rename the columns that are produced by the Data Generator node (they follow a scheme
Universe_<number1>_<number2>
) to <number2> (Uni <number1>)
,
you would use as search string: "Universe_(\d+)_(\d+)" and as replacement: "$2 (Uni $1)".
The special sequence $i
represents the current column index (unless escaped by '\' (backslash)).
E.g. in order to precede each column name with the column index, use as search string "^.+$", matching
the entire column name, and as replacement "$i: $0".
Further documentation regarding regular expressions can be found in the Java API documentation, in particular the classes Pattern and Matcher.
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.
To use this node in KNIME, install the extension KNIME Database from the below update site following our NodePit Product and Node Installation Guide:
A zipped version of the software site can be downloaded here.
Deploy, schedule, execute, and monitor your KNIME workflows locally, in the cloud or on-premises – with our brand new NodePit Runner.
Try NodePit Runner!Do you have feedback, questions, comments about NodePit, want to support this platform, or want your own nodes or workflows listed here as well? Do you think, the search results could be improved or something is missing? Then please get in touch! Alternatively, you can send us an email to mail@nodepit.com.
Please note that this is only about NodePit. We do not provide general support for KNIME — please use the KNIME forums instead.