Replace String function

The Replace String function replaces individual characters or a string with other individual characters or string.

Parameter: input

The string to search for characters to be replaced. The value for this parameter can be provided by a source node, the result of another function, or a value you specify.

Parameter: pattern

A regular expression pattern that needs to be replaced. The value for this parameter can be provided by a source node, the result of another function, or a value you specify.

Parameter: replace

Any substring within the input that matches the pattern will be replaced with the Replace String. The value for this parameter can be provided by a source node, the result of another function, or a value you specify.

Returns: string

The result of replacing all occurrences of pattern that are found in the first parameter (input) with the matching string in the second parameter (pattern).

Example

This example shows a simple replacement of a substring matching a regular expression in pattern parameter, as shown in the following figure:

The runtime result of running this function is the following string:

Replaceeeee

The string that matches the pattern with the value Re* will be replaced by the replace string Dis.
Note: In this example, the input parameter is hardcoded to a specific value. Typically this value is supplied by a source node in a map.



Feedback | Notices


Timestamp icon Last updated: Wednesday, February 17, 2016


http://pic.dhe.ibm.com/infocenter/wci/v7r0m0/topic/com.ibm.wci.doc/ref_ReplaceString.html