Workflow
IAP Regex Operations Transformations
Overview
This Transformation Project contains several transformation examples that are used for regex operations in Itential Automation Platform (IAP).
Transformations
Name | Overview |
---|---|
Test Regex Match - IAP | Execute a search for a match between a regular expression and a specified string and return a boolean value |
Find Regex Match Index - IAP | Find the index of the first occurrence of a regular expression pattern in a string |
Replace Substring or Regex - IAP | Execute a search for a match in a string, and replaces the match with a replacement substring |
Extract Matches From Regex - IAP | Retrieve the result of matching a string against a regular expression |
For further technical details on how to install and use this Transformation Project, please click the Technical Documentation tab.
Table of Contents
Getting Started
This section is helpful for deployments as it provides you with pertinent information on prerequisites and properties.
Helpful Background Information
Transformation are used to translate data from one format to a different format.
Prerequisites
Itential Transformation Projects are built and tested on particular versions of IAP. In addition, Transformation Projects are often dependent on external systems and as such, these Transformation Projects will have dependencies on these other systems. This version of IAP - Regex Operations has been tested with:
- IAP 2023.2
External Dependencies
No external dependencies required to run this Transformation Project.
Adapters
No adapters required to run this Transformation Project.
How to Install
To install the Transformation Project:
- Verify you are running a supported version of the Itential Automation Platform (IAP) as listed above in the Supported IAP Versions section in order to install the Transformation Project.
- Import the Transformation Project in Admin Essentials.
Testing
Cypress is generally used to test all Itential Transformation Projects. While Cypress is an opensource tool, at Itential we have internal libraries that have been built around Cypress to allow us to test with a deployed IAP.
When certifying our Transformation Projects for a release of IAP we run these tests against the particular version of IAP and create a release branch in GitLab. If you do not see the Transformation Project available in your version of IAP please contact Itential.
While Itential tests this Transformation Project and its capabilities, it is often the case the customer environments offer their own unique circumstances. Therefore, it is our recommendation that you deploy this Transformation Project into a development/testing environment in which you can test the Transformation Project.
Using this Transformation Project
Transformation Projects contain 1 or more transformations. Each of these transformations have different inputs and outputs.
Extract Matches From Regex - IAP
Retrieve the result of matching a string against a regular expression
Capabilities include:
- The transformation enables users to retrieve the result of matching a string against a regular expression
Entry Point IAP Component
The primary IAP component to run Extract Matches From Regex - IAP is listed below:
IAP Component Name | IAP Component Type | Extract Matches From Regex - IAP | Transformation |
---|
Inputs
The following table lists the inputs for Extract Matches From Regex - IAP:
Name | Type | Required | Description | Example Value |
---|---|---|---|---|
inputString | string | yes | The string on which to perform the pattern matching | For more information, see Chapter 1.2.3 |
regex | string | yes | The regular expression pattern that defines the search criteria | /see (chapter \d+(\.\d)*)/i |
Outputs
The following table lists the outputs for Extract Matches From Regex - IAP:
Name | Type | Description | Example Value |
---|---|---|---|
matchedArray | array | An array containing the matches found based on the specified pattern | [
"see Chapter 1.2.3",
"Chapter 1.2.3",
".3"
] |
Query Output
There are no query output examples for Extract Matches From Regex - IAP.
Example Inputs and Outputs
Example 1
Input:
{ "inputString": "For more information, see Chapter 1.2.3", "regex": "/see (chapter \d+(\.\d)*)/i" }
Output:
[ "see Chapter 1.2.3", "Chapter 1.2.3", ".3" ]
Example 2
Input:
{ "inputString": "123", "regex": "/1.3/" }
Output:
[ "123" ]
API Links
As noted on the JSON Schema Transformation (JST) Designer documentation for Using a Method, select the information (i)
icon in the header of the method to be redirected to the Mozilla Developer Network JavaScript reference documentation for the method.
API Name | API Documentation Link | API Link Visibility |
---|---|---|
IAP JSON Schema Transformation (JST) Designer | https://docs.itential.com/docs/jst-designer-2023-1 | Public |
Using Transformations in IAP Workflows | https://docs.itential.com/docs/transformation-options-4 | Public |
Find Regex Match Index - IAP
Find the index of the first occurrence of a regular expression pattern in a string
Capabilities include:
- The transformation enables users to execute a search for a match between a regular expression and a string, returning the index of the first match in the string.
Entry Point IAP Component
The primary IAP component to run Find Regex Match Index - IAP is listed below:
IAP Component Name | IAP Component Type | Find Regex Match Index - IAP | Transformation |
---|
Inputs
The following table lists the inputs for Find Regex Match Index - IAP:
Name | Type | Required | Description | Example Value |
---|---|---|---|---|
inputString | string | yes | The string in which we want to find the pattern | Hello, world! |
regex | string | yes | The regex pattern that defines the specific sequence or pattern of characters to look for in the input string | /world/ |
Outputs
The following table lists the outputs for Find Regex Match Index - IAP:
Name | Type | Description | Example Value |
---|---|---|---|
index | number | The index of the first occurrence of the pattern within the input string | 7 |
Query Output
There are no query output examples for Find Regex Match Index - IAP.
Example Inputs and Outputs
Example 1
Input:
{ "inputString": "Hello, world!", "regex": "/world/" }
Output:
7
Example 2
Input:
{ "inputString": "Hello world!", "regex": "/[^\w\s']/g" }
Output:
11
API Links
As noted on the JSON Schema Transformation (JST) Designer documentation for Using a Method, select the information (i)
icon in the header of the method to be redirected to the Mozilla Developer Network JavaScript reference documentation for the method.
API Name | API Documentation Link | API Link Visibility |
---|---|---|
IAP JSON Schema Transformation (JST) Designer | https://docs.itential.com/docs/jst-designer-2023-1 | Public |
Using Transformations in IAP Workflows | https://docs.itential.com/docs/transformation-options-4 | Public |
Replace Substring or Regex - IAP
Execute a search for a match in a string, and replaces the match with a replacement substring
Capabilities include:
- The transformation enables users to execute a search for a match in a string, and replace the match with a replacement substring
Entry Point IAP Component
The primary IAP component to run Replace Substring or Regex - IAP is listed below:
IAP Component Name | IAP Component Type | Replace Substring or Regex - IAP | Transformation |
---|
Inputs
The following table lists the inputs for Replace Substring or Regex - IAP:
Name | Type | Required | Description | Example Value |
---|---|---|---|---|
inputString | string | yes | The original string | Today is Monday |
substring | string | no | A plain substring to search for and replace within the input string. If "substring" and "regex" are included, "substring" is used by default and the "regex" is ignored. Note that if "substring" is provided, only the first match is replaced | Monday |
regex | string | no | A regular expression to search for and replace within the input string. If "substring" and "regex" are included, "substring" is used by default and the "regex" is ignored | /Is/i |
replacementString | string | yes | The value that replaces the occurrences of the pattern in the input string | is not |
Outputs
The following table lists the outputs for Replace Substring or Regex - IAP:
Name | Type | Description | Example Value |
---|---|---|---|
newString | string | A new string where occurrences of a specified substring or regular expression pattern have been replaced with a specified replacement string | Today is not Monday |
Query Output
There are no query output examples for Replace Substring or Regex - IAP.
Example Inputs and Outputs
Example 1
Input:
{ "inputString": "Today is Monday. Tomorrow is Tuesday", "substring": "", "regex": "/Is/gi", "replacementString": "is not" }
Output:
Today is not Monday. Tomorrow is not Tuesday
Example 2
Input:
{ "inputString": "Today is Monday. Tomorrow is Tuesday", "substring": "is", "regex": "/Is/gi", "replacementString": "is not" }
Output:
Today is not Monday. Tomorrow is Tuesday
API Links
As noted on the JSON Schema Transformation (JST) Designer documentation for Using a Method, select the information (i)
icon in the header of the method to be redirected to the Mozilla Developer Network JavaScript reference documentation for the method.
API Name | API Documentation Link | API Link Visibility |
---|---|---|
IAP JSON Schema Transformation (JST) Designer | https://docs.itential.com/docs/jst-designer-2023-1 | Public |
Using Transformations in IAP Workflows | https://docs.itential.com/docs/transformation-options-4 | Public |
Test Regex Match - IAP
Execute a search for a match between a regular expression and a specified string and return a boolean value
Capabilities include:
- The transformation enables users to execute a search for a match between a regular expression and a specified string. It returns true if there is a match; false otherwise
Entry Point IAP Component
The primary IAP component to run Test Regex Match - IAP is listed below:
IAP Component Name | IAP Component Type | Test Regex Match - IAP | Transformation |
---|
Inputs
The following table lists the inputs for Test Regex Match - IAP:
Name | Type | Required | Description | Example Value |
---|---|---|---|---|
inputString | string | yes | The string to test for a match against a regular expression pattern | hello world! |
regex | string | yes | The regex pattern that defines the specific sequence or pattern of characters to look for in the input string | /^hello/ |
Outputs
The following table lists the outputs for Test Regex Match - IAP:
Name | Type | Description | Example Value |
---|---|---|---|
returnBool | boolean | If it finds a match, it returns true, otherwise it returns false. | true |
Query Output
There are no query output examples for Test Regex Match - IAP.
Example Inputs and Outputs
Example 1
Input:
{ "inputString": "Table tennis", "regex": "/tennn*/g" }
Output:
true
Example 2
Input:
{ "inputString": "hello world!", "regex": "/hello$/" }
Output:
false
API Links
As noted on the JSON Schema Transformation (JST) Designer documentation for Using a Method, select the information (i)
icon in the header of the method to be redirected to the Mozilla Developer Network JavaScript reference documentation for the method.
API Name | API Documentation Link | API Link Visibility |
---|---|---|
IAP JSON Schema Transformation (JST) Designer | https://docs.itential.com/docs/jst-designer-2023-1 | Public |
Using Transformations in IAP Workflows | https://docs.itential.com/docs/transformation-options-4 | Public |
Additional Information
Support
Please use your Itential Customer Success account if you need support when using this Workflow Project.