Zetect Expressions & Transforms Back to zetect.inSwitch portal ⇄

String Transforms

Reshape text: change case, trim, replace, join, split, or apply a regular expression. All options accept ${name} tokens. Examples use a person with firstName Priya, lastName Sharma and email Priya.Sharma@example.com.

uppercase

Returns the input in upper case. Returns no value when there is no input.

OptionDescriptionDefault
inputThe text to convert.The previous step's result in a pipeline; otherwise none
{ "type": "uppercase", "input": "${department}" }
department = Finance → FINANCE

lowercase

Returns the input in lower case. Returns no value when there is no input.

OptionDescriptionDefault
inputThe text to convert.The previous step's result in a pipeline; otherwise none
{ "type": "lowercase", "input": "${email}" }
Priya.Sharma@example.com → priya.sharma@example.com

trim

Removes spaces, tabs and line breaks from both ends of the input. Spaces inside the text are kept. Returns no value when there is no input.

OptionDescriptionDefault
inputThe text to trim.The previous step's result in a pipeline; otherwise none
{ "type": "trim", "input": "${department}" }
"  Human Resources " → "Human Resources"

replace

Replaces every occurrence of a piece of literal text in the input. The text to find is not a regular expression; use regex for patterns. Matching is case-sensitive.

OptionDescriptionDefault
inputThe text to change.The previous step's result in a pipeline; otherwise none
searchThe text to find. You can name this option find instead; if both are present, search is used.None: the input is returned unchanged
replaceThe text to put in its place.Empty, so matches are deleted
{ "type": "replace", "input": "${phone}", "search": "-", "replace": "" }
040-555-0187 → 0405550187

{ "type": "replace", "input": "${phone}", "find": "-", "replace": "." }
040-555-0187 → 040.555.0187

concat

Joins a list of values in order, with nothing between them. Put separators in the list as their own entries. Each entry can contain tokens, and a token for a missing attribute adds nothing. concat ignores input and the previous step's result.

OptionDescriptionDefault
valuesA JSON list of the values to join.None: no value is returned
{ "type": "concat", "values": ["${firstName}", " ", "${lastName}"] }
→ Priya Sharma

{ "type": "concat", "values": ["${firstName}", " ", "${middleName}", "${lastName}"] }
no middleName → Priya Sharma

split

Splits the input wherever the delimiter appears and returns one part. The delimiter is literal text, not a regular expression. Empty parts are kept and counted.

OptionDescriptionDefault
inputThe text to split.The previous step's result in a pipeline; otherwise none
delimiterThe separator. If it is missing or empty, the whole input is returned.None
indexWhich part to return, counting from 0. A negative number counts from the end, so -1 is the last part. An index past either end returns no value.0
{ "type": "split", "input": "${email}", "delimiter": "@", "index": 0 }
Priya.Sharma@example.com → Priya.Sharma

{ "type": "split", "input": "${dn}", "delimiter": ",", "index": 1 }
CN=Priya Sharma,OU=Finance,DC=example,DC=com → OU=Finance

{ "type": "split", "input": "${dn}", "delimiter": ",", "index": -1 }
CN=Priya Sharma,OU=Finance,DC=example,DC=com → DC=com

regex

Applies a regular expression to the input. It works in one of two modes:

  • Replace mode, when the replacement option is present: every match is replaced with the replacement text. If nothing matches, the input is returned unchanged.
  • Extract mode, when there is no replacement: returns a capture group from the first match. If nothing matches, it returns no value.

Patterns use Java regular expression syntax. In JSON, write each backslash twice, for example \\d. An invalid pattern makes the transform return no value.

OptionDescriptionDefault
inputThe text to match against.The previous step's result in a pipeline; otherwise none
patternThe regular expression.None: the input is returned unchanged
replacementReplace mode only. The text to put in place of each match. It is used literally: $1 is not a group reference.Not set, which selects extract mode
groupExtract mode only. The capture group to return; 0 is the whole match. A group the pattern doesn't have returns no value.1 if the pattern has a group; otherwise 0
Extract the domain of an email
{ "type": "regex", "input": "${email}", "pattern": "@(.+)$" }
Priya.Sharma@example.com → example.com

Extract the second group
{ "type": "regex", "input": "${email}", "pattern": "(\\w+)\\.(\\w+)@", "group": 2 }
Priya.Sharma@example.com → Sharma

Extract the whole match from a pattern with no groups
{ "type": "regex", "input": "${employeeId}", "pattern": "[0-9]+" }
EMP-00421 → 00421

Keep only digits
{ "type": "regex", "input": "${phone}", "pattern": "[^0-9]", "replacement": "" }
+91 98450-12345 → 919845012345