This deprecated node replaces one or more given segments of text with other segments of text.
To enable the Replace Text node, configure the Fields and Rules properties by entering Script.
- In the Fields property, specify which field(s) of the input data you want to apply the text substitution rule to, in the following format:
<FieldName>=<RuleName>
For example, to apply a rule to a specific input field (in this case
text1
), specify the field name as follows:text1=rule1
Alternatively, to indicate that the rule should apply to all fields (columns) of the input data, use '
*
':*=rule1
- In the Rules property, define the text substitution rule(s) to apply to the specified input data. Each rule should be introduced with a header line, followed by the substitution rule, in the following format:
<RuleName>::<SubstitutionRule>
A header line is a section name followed by two colons.
There are three types of substitution that you can use, as follows:
- Character mapping converts the characters on the left side of the rule to the characters on the right side of the rule, using the following format, where 'a' becomes 'z':
a->z
- Translate mapping converts 'a' to 'd', 'b' to 'e' and 'c' to 'f', using the following format:
abc:>def
- Invocations reference a rule within a rule, using the following format:
rule::
<RuleReference>
- Character mapping converts the characters on the left side of the rule to the characters on the right side of the rule, using the following format, where 'a' becomes 'z':
a->z
results in a
becoming z
and A
becoming Z
.Example
The following example illustrates all three substitution rule types. Take the following input data:
text1 | text2 | text3 |
---|---|---|
abc1 | def1 | ghi1 |
ABC1 | DEF1 | GHI1 |
CBA1 | FED1 | IHG1 |
In the Fields property, enter the following Data360 Analyze Script which results in rule name rule1
applying to all fields from the input data:
*=rule1
In the Rules property, enter the following Data360 Analyze Script:
rule0::1->0rule1::ai:>jz<rule0>
The output is as follows:
text1 | text2 | text3 |
jbc0 | def0 | ghz0 |
JBC0 | DEF0 | GHZ0 |
CBJ0 | FED0 | ZHG0 |
rule1
is specified in the Fields property, both rule1
and rule0
have been acted upon; this is because rule0
is referenced within rule1
.Properties
Fields
Specify which fields from the input data that you want to apply the text substitution rules to along with the name of the rule. For example, for a rule named rule1
that is to apply to all fields, enter *=rule1
.
A value is required for this property.
Rules
Define the text substitution rules to apply to the specified input fields.
Each rule should be introduced with a header line, followed by the substitution rule. For example, to substitute 1
with 0
, enter: rule1::1->0
A value is required for this property.
Inputs and outputs
Inputs: in1.
Outputs: out1.