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 |
New string you want to use instead. If you leave this field blank, replaces the original string with a blank space. |
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
: class -
replace
: 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".