Boxes - Split String

1. Split String

This box is primarily used to extract one or more parts from a specific category path, even though the rule can be applied to any column in your feed.

The extraction is achieved by splitting the text using what we call separators.

You can use it if you only need one part of a value, or just the beginning/end.

Example text: "Wheels > Tires > Pirelli"

Goal: Extract the value "Tires"

Setup:

96d2a7f5084cc3b6f7d0bd72deb5a861.png

Splitter: This refers to the actual point of separation, also known as the separator. In this case it is ">"

From: Indicates where the split should start at. It includes the item number inserted here.

Item: Refers to the number of items you wish to extract from the beginning of the split. Please note that item counting starts at zero (0). And anything before the first separator is always a zero value - refer to advanced example for clarification. What does this mean? If you want to extract the second value you need to enter a number 1.

72fa9e75e5f49a378e4e17fa98a00da9.png

If the goal was to extract “Tires > Pirelli”, then in "Items" you would need to insert "2".

If however you wish to extract "Wheels", then you would need to insert "From: 0" and "Item: 1".

Use negative values for reverse counting

Using "From: -1” and "Items: 1” would result in “Pirelli”. Using “-1” as value for “From:” makes it always using the last value. This is very handy when the number of items varies. Using "-2" would return the item before the last one.

Advanced example:

The “Split String” box can also be used to separate long texts with a fixed structure into its single elements.

Example text:

“This is a sample description about an imaginary product. Its description always contains a listing of its features at the end. Features: not very long, just an example. Ingredients: sugar, water and fresh air.”

With the help of the “split string” box you could do the following:

Goal: Separate the list of features

Approach:

1- Remove the “Ingredients:" by using:

8f667c4bec3c5b9b7f6d22af4c7b78c2.png

Because the splitter is "Ingredients:", anything before that is a zero. So, even though there are 2 sentences before "Ingredients:", together they are Item 0.

Therefore the result you get is:“This is a sample description about an imaginary product. Its description always contains a listing of its features at the end. Features: Not very long, just an example."

2- Now you can add another box to separate the features by using: "Splitter: “Features:”, "From: 1", "Items: 1":

26a6496ac98819c27a3eb65370b9ecaa.png

Which would return the desired result: “Not very long, just an example.”

Please note: When a word is used as a separator, it will not be counted as an item - as it is the separator.

The only time the word will remain in a text will be if you extract 2 or more values, as the separator is always visible between values.

2. Split String & Filter

The box Split String & Filter works similar to the Box Split String, just that there is the filter function included.

The filter detects if something is wrong and skips it and does not recite it.

41c90cbbc55e18414509a3a278157483.png

Example:

2a0f3cd9e715515528548d7546c027ae.png

"Kategory1<Kategory2<BJKHBUB<Kategory3<Kategory3"

"BJKHBUB" will be ignored because it is identified as an error term