Replace
Overview
Use the replace transform to find a given pattern of characters within incoming data and replace all instances of that pattern with alternate values. The transform recognizes standard regex syntax. See the References section for more information about regex.
Transform Structure
The replace transform takes a regex
attribute as an argument to identify which pattern to replace and a replacement
attribute for the characters to replace the pattern with. The transform also requires the standard type
and name
attributes:
{
"attributes": {
"regex": "IIQ",
"replacement": "Identity Security Cloud"
},
"type": "replace",
"name": "Replace Transform"
}
Attributes
-
Required Attributes
- type - This must always be set to
replace
. - name - This is a required attribute for all transforms. It represents the name of the transform as it will appear in the UI's dropdown menus.
- regex - This is the pattern you want to replace.
- replacement - This is the replacement string that replaces the pattern wherever it occurs.
- type - This must always be set to
-
Optional Attributes
- requiresPeriodicRefresh - This
true
orfalse
value indicates whether the transform logic should be reevaluated every evening as part of the identity refresh process. - input - This is an optional attribute that can explicitly define the input data passed into the transform logic. If no input is provided, the transform takes its input from the source and attribute combination configured with the UI.
- requiresPeriodicRefresh - This
Examples
This transform makes a simple word replacement, exchanging "IIQ" for "Identity Security Cloud".
Input: "Working with IIQ is fun"
Output: "Working with Identity Security Cloud is fun"
Transform Request Body:
{
"attributes": {
"regex": "IIQ",
"replacement": "Identity Security Cloud"
},
"type": "replace",
"name": "Replace Transform"
}
This example uses a more complex regex pattern to remove any non-alphabet characters from the input string.
Input: "The quick brown fox jumped over 10 lazy dogs"
Output: "Thequickbrownfoxjumpedoverlazydogs"
Transform Request Body:
{
"attributes": {
"input": "The quick brown fox jumped over 10 lazy dogs",
"regex": "[^a-zA-Z]",
"replacement": ""
},
"type": "replace",
"name": "Replace Transform"
}