Regex
The Regex manipulator is able to use regex to search and replace matches or parts of a match separated into groups. The regex manipulator also has support for replacing IDs using Impulse's ID maps.
Nearly any regex string can be used to find a match to replace.
Properties
fieldName
The field name to apply regex to.
True
regex
Regex to apply
True
replace
Replacement string
False
delim
Delimiter to parse regex with
False
sourceContentType
The source content type to search for a mapped ID with
False
destinationContentType
The destination content type to search for a mapped ID with
False
regexLanguage
The language of regex to run expression with
False
destinationEndpointId
Destination Endpoint ID to use when manipulator used "on write"
False
Specifics
How to use
The regex
and replace
properties each take a string value and are required to use the Regex manipulator.
The regex
value is the value to search for and the replace
value is the value that should replace what the regex
value matches.
ID Maps
The Regex manipulator can be used to group a value and replace the value with an ID map from Impulse.
The replace
value must start and end with a pair of curly brackets {}
. Inside the curly brackets the path of the ID to replace must be set. i.e., {content.id}
or {content.version.id}
delimiter
Comma is used as the default delimiter for the replace
value. The replace value can be separated when groups need to be individually replaced with values. This allows for using groups and ID maps to replace segments of a match with different values.
Groups
Groups can be used in the regex
value . When using groups each group can be set in the replace
value by using ${#} notation. i.e., $1 will refer to the first group. $3 will refer to the third group.
When using groups in regex
value, use a delimiter to specify how to replace each group in the replace
value. the group number directly relates to the segment number broken by delimiter.
i.e., regex is used to create 3 groups. replace
value should use 2 delimiters.
Source/Destination Content Type
These options should be used when the content.id
being replaced has been synced to multiple destination content types. Meaning the single source content was synced as multiple destination contents with different content types.
In this case, there is no guarantee what content type would be used to find an ID map. To guarantee what content type to use, set both the sourceContentType
and destinationContentType
.
This is only required when the content.id
map being searched for was previously synced as multiple destination contents with different content types. If the content.id
was only synced to a single content type at the destination, then these config options are not required.
Regex Language
The following languages can be used for the provided regex.
PCRE2
RE2
Based on the selected Regex language, not all functionality may be available.
RE2
This is the default language used.
The RE2 language has full support for all functionality of the regex manipulator. It's limitations are the limitations of the RE2 language. Such as no lookahead/lookbehind support.
PCRE2
The PCRE2 langauge only supports global search and replace. Meaning that every match found will be replaced.
Because it only supports global search and replace functionality such as ID Maps and select group replacements are not supported.
Examples
Basic search and replace
This example shows using a simple regex to search and replace each instance with a simple value.
Assume your initial value is as follows.
You now want to replace each occurrence of "string" with "text". You can do this by setting the following values.
You'd then have this final value.
Replacing URL paths to files (RE2 only)
This example shows how groups and ID maps can be used together with a delimiter to replace the URL path for files that have been previously migrated via an Impulse sync.
The problem is that the asset migrated to the destination now has a new file path because its IDs have changed.
Assume you have the following value.
The following values in the URL need to be replaced as follows.
This can be accomplished by using the delimiter in the replace
value and combing the use of groups and ID map support. The following regex and replace value can be used.
The regex
value creates a match for URL from /v3
to \"
. 8 groups are used to segment the entire match so each segment can be individually replaced or kept.
In the replace
value, a comma is used as a delimiter to specify when a static value is used, a group is used or an ID map value is used for every group created in the regex.
Groups 1, 3, 5, and 7 have all been kept the same and in the same place.
Group 2 was replaced with the static value
blt69509c911644abcd
.Group 4 was replaced with the ID map value found for {content.id}. In this case,
blt9cd3e9a81dd9315a
.Group 6 was replaced with the ID map value found for {content.version.id}. In this case,
645506c0a5217e70d3f9a3d2
.Group 8 was replaced with the static value
?branch=migration_poc"
Using these configuration values, the URL can then become the following value.
Each group specified has been kept or replaced.
This example can be expanded for multiple matches.
Assume you have an HTML value with img
tags that have a path to an asset that was previously migrated to the destination via an Impulse sync. The value may look something like the following
Using the same config, the following value can be created.
Last updated