A
split-regex
transformation divides the value of a
dimension or property into separate values and assigns each separate value to a
new dimension or property.
This transformation is useful when your product data contains an
attribute whose value is a delimited list of values. Such a list is not usable
for user navigation. However, the
split-regex
transformation can split the list into
separate values that are useful for navigation.
The transformation uses a regex pattern to determine where to split the dimension or property value. The pattern can be either a single character or a more complex regex pattern; for example, the pattern:
"(\-\-)|[,;]"
specifies that a value is split at any occurrence either of two dashes or of a comma and a semicolon.
Suppose that your product data provides the following different values for a dimension named country:
"country": "UK, US, DE"
Such an assignment is not useful for user navigation by dimension. The
split-regex
transformation, however, can convert this
assignment into assignments that are useful for user navigation, as follows:
"country": "UK", "country": "US, "country": "DE"
The conversion above is performed by the following split-regex transformation:
{ "ecr:type": "attributes-owner-folder", "country": { "ecr:type": "dimension", "mergeAction": "update", "indexingTransforms": [ { "transform": "split-regex", "pattern": "," } ], "ignoreDuplicatePropertyValues": "true" } }
The following table lists the properties of the split-regex transformation:
Property |
Data type |
Default value |
Comments |
"transform" |
String |
n/a |
Required. Must be set to "split-regex" Example:
|
"splitPattern" |
String |
none |
Required. The regex pattern must comply with java.util.regex.Pattern. Example:
|
"sourcePropertyNames" |
JSON Array |
The name of the attribute to which this transform applies. |
Optional. Example:
|
"ignoreDuplicatePropertyValues" |
Boolean |
True |
Optional. Example:
|
"trimWhitespace" |
Boolean |
True |
Optional. Example:
|
"removeSourcePropertyValues" |
Boolean |
True when the source property is the same as the attribute name. False otherwise. |
Optional. |