Moogsoft Docs

replaceString

A Workflow Engine function that replaces a string or regular expression in a field with a specified string or regular expression.

This function is available for alert, enrichment, and Situation workflows.

Back to Workflow Engine Functions Reference.

Arguments

Workflow Engine function replaceString takes the following arguments:

Name

Required

Type

Description

field

Yes

String

Field to replace text in.

replace

Yes

String

Original string or regular expression you want to replace. Use escaping for regular expressions. For example \s not s.

with

Yes

String

New string or regular expression you want to use instead.

Example

The following example demonstrates typical use of Workflow Engine function replaceString.

Some systems abbreviate "database" as "d.b." or "D.B.". If you want to replace this abbreviation in the "class" field with "database", set the following:

  • field: class

  • replace: /d\.b\./ig

  • with: database

The UI translates your settings to the following JSON:

{"field":"class","replace":"/d\\.b\\./ig","with":"database"}

The function returns true if it replaces any instances of "d.b." or "D.B." and continues processing subsequent actions and workflows. Otherwise, it returns false.