Replace values in Tables¶
In the standard library there exist two nodes which perform a search and replace of values among the elements in Tables. Of the two nodes, one operates on single Table while the other operates on multiple Tables.
In the configuration of the nodes one has to specify the columns in the Tables which will be regarded during the execution of the node. At the moment the node is restricted to string and unicode columns.
For string and unicode columns the search and replace expressions may be regular
expressions. Here, it is possible to use ()-grouping in the search expression
to reuse the match of the expression within the parentheses in the replacement
expression. In the regular expression for the replacement use \1
(or
higher numbers) to insert matches.
As an example let’s say that you have an input table with a column containing
the strings x
, y
, and z
. If you enter the search expression
(.*)
and the replacement expression \1_new
the output will be the
strings x_new
, y_new
, and z_new
.
-
class
node_table_value_search_replace.
TableValueSearchReplaceMultiple
[source]¶ Search and replace string and unicode values in Tables.
Inputs: - tables : Tables
Tables with values to replace
Outputs: - tables : Tables
Tables with replaced values
Configuration: - Select columns
Select the columns which to apply the search and replace routine to.
- Search expression
Specify search expression If selected columns are of string type, regex can be used.
- Replacement expression
Specify replacement expression. If selected columns are of string type, regex can be used.
Ref. nodes: