# Boxes - Replace Functions

Example sentence: In this example the word "appears" appears two times.

## 1. Text Replace

Impact on our example sentence: In this example the word "exists" exists two times.

Note: Every occurrence of the search term will be replaced.

## 2. Remove Spaces

This box can also be used to remove spaces:

Impact on our example sentence: Inthisexampletheword"appears"appearstwotimes.

Note: The "Replace (with)" field can be left empty. In this way, unwanted words or characters will be removed and nothing will substitute them.

This box can be really helpful to remove empty spaces in your URL, where they could potentially break the link. You could also remove consecutive whitespace by entering two or more empty space in "Search" - however an easier and better way to do this is to use the specially designated "Remove Consecutive Whitespace" box.

While the Text Replace box will delete both whitespaces, the Remove Consecutive Whitespace box will only remove the extra spaces, so as to leave one space left.

## 3. Remove Duplicate Words

This box removes words that appear more than once in a string.

Enter the Delimiter separating the words if required (for example with ; or / or just white spaces).

## 4. Map-Replace

Instead of adding multiple Text Replaceboxes, you can replace many things simultaneously by storing one rule per line in a single Map-Replace box.

The syntax is as follows:

search term{delimiter}replace term

Impact on our example sentence: Inthisexampletheword"exists"existstwotimes.

You can select the Case sensitivity in the dropdown underneath the input field.

Choosing the List Delimiter is helpful if the text you are replacing contains a certain character that is also a popular delimiter sign. If you want to e.g. replace http:// with https://, you would choose a delimiter that is not colon, but potentially comma: http://,https:// Choosing colon as a delimiter in this case would otherwise result in http being replaced with //.

Note: Please don't use this box with more than 500 values. If you want to replace more than 500 terms, please use our List feature.

Leaving the part after the delimiter empty will result in the search term being removed/replaced with nothing.

Impact on our example sentence: In this the word "" two times.

## 5. Mapping

This box handles the values of an attribute as a whole. In other words an entire phrase, not just a single word, is replaced with the values you insert. You always need to add the complete string to make a replacement.

The Case dropdown lets you choose between matching case sensitive or insensitive.

Example Text: "This is blue"

Using this configuration would not have any effect at all:

Unchanged Result: "This is blue"

To modify this string, you would need to use this configuration:

Result: "blue"

Note: Additional mappings can be saved in new lines, just as in the Map-Replace box.

## 6. Text replace if column contains

This box works similar to the Map-Replace box, but you can set a condition for replacing.

Example:

For all the product Types 1044 we want to replace the size "116- 140" by "one size".

In the dropdown you can choose if the value in the column should contain or equal the value you set.

## 7. Replace In Between

This box can be used to remove or replace value between two other values:

Example Text:

In this example the word "appears" appears two times.

Result:

In this example the word exists appears two times.

Note: Both values in From and To will disappear.

## 8. Remove Terms in Brackets

This box can be used to remove values between two brackets:

Example:

In this example the word (appears) appears two times.

Result:

In this example the word appears two times.

## 10. Replace Dynamic Value

With the box Replace Dynamic Value you replace a value taken from an other column.

If you want to replace the brand in the title by the price and the price changes, the price in the title will be changed too.

You also can replace a value taken from a column by a Static value.

Requirements You need to have a column which takes its values from an other column.

Columns which do this are often the title or the description column.

Example for the column title:

Title: Pizza fresh and delicious Dr.Ütker

New Title: Pizza fresh and delicious 12,10€

Note: If you fill in the box Static value, what you wrote in Replace Column will disappear:

New Title: Pizza fresh and delicious today supersale

If you work with prices, you may have to use the Make Valid Price- Box before.

## 11. Numeric Compare

If you want to change a value in a column when it is more/less than/ the same like an other value, then use this box.

1 - Chose the column, you want to compare.

2 - than chose, if your criteria is that it should be smaller or bigger than an other value:

< smaller

> greater

>= greater or the same

<= smaller or the same

== the same

!= unequal/ not the same

3 - Now select the column in which the value you want to compare is in.

4 - select, what happens if there is a match:

5 - select, what happens if there is no match:

## 12. Compare Columns

This box works similar to the box Numeric Compare, but here you can compare not just numbers, also text.

1. In Column A and B select the columns, you want to compare.

2. Handle match: fill in the value you want to assign/put pre- or append if there is a match, or leave it unchanged.

3. Handle no match: fill in the value you want to assign/put pre- or append if there is no match, or leave it unchanged.

For match, the whole text in the column has to be the same. For finding words from one Column in an other, use one of this boxes.

## 13. Replace if Column Contains

With this box you can replace a value by an other if a specific word is found in the other column.

Example:

Aim: Your are editing the title and you want to assign the word "Pizzaspecial" instead of "Pizza", if the product is from "Dr.Ottker".

1 - As you always do, chose the column you want to edit. Here it is the column where you want to replace a value.

2 - Now you have to chose the column where you want to search for a word (chose it in the dropdown).

Fill in the word you are searching for in the text field.

3 - Now fill in the word you want to be replaced in column you are editing.

4 - At last you have to write the word you want to replace the word before by.

criteria we seach for in the column brand : word you want to be replaced in the column title : word that replaces the word before

Result:

For all the products that are (from the brandt) "Dr.Ottker", in the title there will assign "Pizzaspecial" instead of "Pizza"

You can also use this box for id or category as reference columns.

## 14. For advanced users: use Regular Expressions with Preg Boxes

This boxes are only intended for advanced users who are already familiar with regular expressions.

For users without any background- knowledge, here we show you the use of those boxes with an easy example.

## 14.1 Preg Replace

This function searches for a Regular Expression and replaces it by the Expression you fill in the box Replace.

This example searches for all the numbers from 1 to 7, and replaces them by "under 8".

For an overview and detailed description click here (in German) or here(in English).

## 14.2 Preg Match

This box works with Regular Expressions and is only intended for advanced users.

This box works as a kind of opposite to Preg Replace: Instead of choosing what to find and replace, you are choosing what to match and keep. You can use Preg Match for both simple match types and complex match types involving more than one variable.

We’ll use this text for some examples below: "This is the description of one of our products, details: colour: white, size: XS, brand: Nike."

For the simplest use case - finding a single type of value and keeping only it in a longer string - complete the RegEx field with the regular expression you want to find and keep. In this instance, you can leave the Assign field blank.

Once saved, the rule will apply and only keep the value matched by the regular expression you entered:

New Text: “colour: white”

You can also use Preg Match for more complex operations:

1 - In the RegEx field you fill in the Regular Expression you want to search.

2 - Assign: you fill in the number of expressions you want to replace the text by.

0: finds everything that is in your expression

1: finds the expression in the first parentheses

2: finds the expression in the second parentheses

Example Text: "This is the description of one of our products, details: colour: white, size: XS, brand: Nike."

Value in RegEx: “#(colour: [a-z]+), (size: [SXLM]*)#”

What will assign if you filled in the number 0:

New Text: "colour: white, size: XS"

What will assign if you filled in the number 1:

New Text: "colour: white"

What will assign if you filled in the number 2:

New Text: "size: XS"