replaceString
A Workflow Engine function that replaces a string or regular expression in a field with a specified string.
This function is available for event, alert, and Situation workflows.
Back to Workflow Engine Functions Reference.
Arguments
Workflow Engine function replaceString
takes the following arguments:
Name | Required | Type | Description |
---|---|---|---|
| Yes | String | Field to replace text in. |
| Yes | String | Original string to replace. This value is treated as a regex. Do not include leading or trailing delimiters. |
| No | String | The value you want to replace the original string with. If this is left blank (no value), then occurrences of the original value will be removed. For example, "This is a test" would be replaced with "Thisisiatest". |
Example
The following example demonstrates typical use of Workflow Engine function replaceString
.
Some systems abbreviate "database" as "d.b." or "D.B.". If you had a class
field that contains the value "A D.B. has failed", and you wanted to replace the abbreviation with "database", set the following:
field
: classreplace
: d\.b\.with
: database
The UI translates your settings to the following JSON:
{"field":"class","replace":"d\\.b\\.","with":"database"}
The function replaces any occurrences of "d.b." and "D.B.", so the resulting value reads "A database has failed".