Skip to main content

Replace All

Overview

The replace all transform works like the replace transform, except that it can perform multiple replace operations on the incoming data instead of just one pattern. Use the replace all transform to find multiple patterns of characters within incoming data and replace all instances of those patterns 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 table attribute of key-value pairs as an argument. Each pair identifies the pattern to search for as its key and the replacement string as its value. The transform also requires the standard type and name attributes:

{
"attributes": {
"table": {
"-": " ",
"\"": "'",
"ñ": "n"
}
},
"type": "replaceAll",
"name": "Replace All Transform"
}

Attributes

  • Required Attributes

    • type - This must always be set to replaceAll.
    • 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.
  • Optional Attributes

    • requiresPeriodicRefresh - This true or false 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.

Examples

This transform makes a simple set of special character replacements, exchanging a space for a hyphen and removing the Spanish tilde from the "n."

Input: "Enrique Jose-Piñon"
Output: "Enrique Jose Pinon"

Transform Request Body:

{
"attributes": {
"table": {
".": "-",
"\"": "'",
"ñ": "n"
}
},
"type": "replaceAll",
"name": "Replace All Transform"
}

 

This example uses more complex regex patterns to remove any alphabet characters from the input string and replace periods with hyphens.

Input: "ad512.777.1234"
Output: "512-777-1234"

Transform Request Body:

{
"attributes": {
"input": "",
"table": {
"[.]": "-",
"[a-zA-z]": ""
}
},
"type": "replaceAll",
"name": "Replace All Transform"
}

References