Skip to main content

Search for and replace data

Search for and replace data with rule boxes in Productsup.

Introduction

Certain rule boxes let you search for keywords and replace parts of your data in bulk.

Choose the most appropriate rule box from the following list. Select the links to go directly to the necessary rule box description:

Search for and replace static text

You can search for and replace values across all products in your column with the help of rule boxes. The conditions are static and affect all products containing the search value.

Note

Consider using Lists instead if you are searching for and replacing over 100 conditions. See Replace feed terms with the Standard Replacement list.

There are three rule boxes for static text replacement:

  • Text Replace - A rule box that replaces the same values for all products in one column with another specified value.

  • Map-Replace - A rule box that replaces values within a string with another specified value.

  • Mapping - A rule box replaces the entire string with another specified value.

Replace static text with the Text Replace rule box

To search for and replace the same values for all products in one column, use the Text Replace rule box:

  1. Go to Data View from the site's main menu.

  2. Choose the needed export channel or the intermediate stage in the drop-down menu on the left.

  3. Select Edit in the attribute's column where you want to apply the rule box.

  4. Select the Add Box drop-down menu.

  5. Search for and select the Text Replace rule box.

  6. Enter the value you wish to replace in the Search for field.

  7. Enter the value you wish to have instead of the existing value in the Replace by field. Leave the Replace by field empty to delete your search term or whitespaces. To remove whitespace, see Clean and format your data.

  8. Choose how sensitive your search is relating to capitalization in Case:

    • Sensitive: The search takes capitalization into account.

    • Insensitive: Capitalization has no effect.

  9. Select Save to apply the rule.

The Text Replace rule box

The Text Replace rule box result:

Before

After

In this example, the word "exists" exists two times.

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

Replace multiple values with Map-Replacing or Mapping rule boxes

Instead of applying several Text Replace rule boxes to replace multiple values in a column, you can apply only a single Map-Replace or Mapping rule box.

The difference between the Map-Replace and Mapping boxes is that Map-Replace searches for and matches values within a string, while Mapping searches for and matches values only if the entire string matches.

For example:

1. Map-Replace: If the input value is Jordan 1, then the rule replaces both Jordan 1 and Air Jordan 1:

The example of Map-Replace

2. Mapping: If the input value is Jordan 1, then the rule only matches Jordan 1 and does not replace Air Jordan 1 because the search doesn't match the entire string.

The example of Mapping

The following sections explain each rule box in detail.

Map-Replace rule box

To replace several different values within a string, apply a single Map-Replace box:

  1. Go to Data View from the site's main menu.

  2. Choose the needed export channel or the intermediate stage in the drop-down menu on the left.

  3. Select Edit in the attribute's column where you want to apply the rule box.

  4. Select the Add Box drop-down menu.

  5. Search for and select the Map-Replace box.

  6. Enter each search value line by line into the field.

  7. Add the delimiter directly after your search term. The rule box selects Colon (:) as a default. But you can choose another delimiter in the List Delimiter drop-down menu if, for example, the delimiter is a part of the phrase you want to replace.

  8. Enter the replace value directly after the delimiter.

  9. Choose how sensitive your search is relating to capitalization in Case:

    • Sensitive: The search takes capitalization into account.

    • Insensitive: Capitalization has no effect.

  10. Select Save to apply the rule.

The Map Replace rule box

The Map-Replace rule box result:

Before

After

Please note: you should customize the delimiter in your map-replace box if it appears in your search search or replaces terminologies.

It's important to know that you should customize the delimiter in your map-replace box if it appears in your search or replaces terms.

Mapping rule box

Unlike Map-Replace, which replaces multiple values within a string, the Mapping rule box replaces the entire string. To apply the Mapping rule box:

  1. Go to Data View from the site's main menu.

  2. Choose the needed export channel or the intermediate stage in the drop-down menu on the left.

  3. Select Edit in the attribute's column where you want to apply the rule box.

  4. Select the Add Box drop-down menu.

  5. Search for and select the Map-Replace rule box.

  6. Enter your search value line by line into the field.

  7. Add the colon (:) delimiter directly after your search value.

  8. Enter the replace value directly after the delimiter.

  9. Choose how sensitive your search is relating to capitalization in Case:

    • Sensitive: The search takes capitalization into account.

    • Insensitive: Capitalization has no effect.

  10. Select Save to apply the rule.

The Mapping rule box

The Mapping rule box result:

Before

After

blue

cyan

This product is blue.

This product is blue.

In the second case, blue doesn't change, as the entire string doesn't match the input.

The order of rules operations

When applying the Map-Replace or Mapping rule boxes, remember that the order of the input values is essential, and the order change can lead to different results. The rules process each replacement operation in order from top to bottom.

  • Example 1: This is the result of replacement if the order of lines in the Map-Replace field is as follows:

The Map-Replace rule box order
  • Example 2: With the reverse order, you get a different result from Example 1.

The Map-Replace rule box order reverse

Search for and replace dynamic text based on a condition

You can add rules that search for and replace terms across all products in your column based on a condition. The conditions are dynamic and affect only products that meet the condition.

There are several rule boxes to replace text dynamically based on conditions:

Replace Dynamic Values rule box

The Replace Dynamic Value rule box searches for and replaces a value taken from another column. For example, if your title includes data from the brand column, you can replace the data from the brand column with the data from a selected column or a static value.

Nothing changes if the current column does not contain data from another column. For example, if data from the brand column is not in your title, then no replacement happens.

  1. Go to Data View from the site's main menu.

  2. Choose the needed export channel or the intermediate stage in the drop-down menu on the left.

  3. Select Edit in the attribute's column where you want to apply the rule box.

  4. Select the Add Box drop-down menu.

  5. Search for and select the Replace Dynamic Values rule box.

  6. Choose a column you want to replace in the Search Column drop-down menu.

  7. Choose an option in the Replace Column or enter a value in the Static Value that should appear instead.

  8. Choose if the matching should be broad or exact in Match Type drop-down menu:

    • broad: The Search Column input includes the search term.

    • exact: The search term matches the entire input in the Search Column.

  9. Select Save to apply the rule.

replace_dynamic_value.png

In this example, the platform replaces the data from the availability column with a static value:

Before

After

A great t-shirt, in stock

A great t-shirt, Get it now!

Replace if Column Contains rule box

The Replace if Column Contains rule box searches if there is a match with another column and replaces the data in your current column.

  1. Go to Data View from the site's main menu.

  2. Choose the needed export channel or the intermediate stage in the drop-down menu on the left.

  3. Select Edit in the attribute's column where you want to apply the rule box.

  4. Select the Add Box drop-down menu.

  5. Search for and select the Replace if Column Contains rule box.

  6. In the Column drop-down menu, choose the column to search for a value you want to change.

  7. Enter the values in the following order separating them with a colon (:) delimiter: search column:search for replace:replace, where:

    • search column - A value to search for in the column chosen in the Column drop-down menu.

    • search for replace - A column value you want to search for and replace in the column to which you apply the rule.

    • replace - A replacement value that appears in the current column.

  8. Select Save to apply the rule.

Replace if Column Contains

For example, if the platform finds Birkenstock in the brand column, it replaces adult with kid in the age_group column:

Example of Replace if Column Contains

Compare Columns rule box

The platform compares data in two columns and, if there is a match, assigns a necessary value in the current column:

  1. Go to Data View from the site's main menu.

  2. Choose the needed export channel or the intermediate stage in the drop-down menu on the left.

  3. Select Edit in the attribute's column where you want to apply the rule box.

  4. Select the Add Box drop-down menu.

  5. Search for and select the Compare Columns rule box.

  6. Select columns that you wish to compare in the Column A and Column B drop-down menus.

  7. Choose the action type and enter the replace value in Handle match.

  8. Choose the action type if there is no match between the selected columns in Handle no match.

  9. Choose the action if one of the columns does not exist.

  10. Select Save to apply the rule.

compare_columns.png

In this example, if the value from Column A matches the value from Column B, then the platform replaces all data in the column, to which you apply the rule box with description=title!. If Column A doesn't match Column B, no change happens to the data in the current column.

Remove Duplicate Words rule box

The platform removes duplicate words with the Remove Duplicate Words rule box:

  1. Go to Data View from the site's main menu.

  2. Choose the needed export channel or the intermediate stage in the drop-down menu on the left.

  3. Select Edit in the attribute's column where you want to apply the rule box.

  4. Select the Add Box drop-down menu.

  5. Search for and select the Remove Duplicate Words rule box.

  6. Leave the default delimiter or set a custom one if the values have other boundaries. For example, in a category taxonomy, there can be arrows between the terms.

  7. Select Save to apply the rule.

remove_duplicate_words.png

The Remove Duplicate Words rule box result:

Before

After

Cat Cat Dog Cat Parrot Tortoise

Cat Dog Parrot Tortoise

Text Replace if Column Contains rule box

The platform replaces text based on a condition relating to another column. This rule box works similar to the Map-Replace rule box, but you can set a condition for replacement.

  1. Go to Data View from the site's main menu.

  2. Choose the needed export channel or the intermediate stage in the drop-down menu on the left.

  3. Select Edit in the attribute's column where you want to apply the rule box.

  4. Select the Add Box drop-down menu.

  5. Search for and select the Text Replace if Column Contains rule box.

  6. Select a source column.

    Note

    Ensure that the column exists in the necessary stage before applying this rule. You can select import stage columns for a rule on the intermediate stage.

  7. Choose either equals or contains as the condition in the drop-down menu and enter the condition text in the field.

  8. Enter the search and replace terms.

  9. Select Save to apply the rule.

text_replace_if.png

In this example, if the product_type column for this product equals t-shirts, the result is as follows:

Before

After

This is a Cotton t-shirt.

This is a synthetic fibre t-shirt.

Replace in Between rule box

Replace in Between rule box removes or replaces a value between two other values:

  1. Go to Data View from the site's main menu.

  2. Choose the needed export channel or the intermediate stage in the drop-down menu on the left.

  3. Select Edit in the attribute's column where you want to apply the rule box.

  4. Select the Add Box drop-down menu.

  5. Search for and select the Replace in Between rule box.

  6. Define From and To. The platform replaces the entire phrase, including these values.

  7. Add a replace value into Replace With field.

  8. Select Save to apply the rule.

replace_text_in_between.png

The Replace in Between rule box result:

Before

After

The word "appears" appears two times.

The word exists appears two times.

Remove Terms in Brackets rule box

The Remove Terms in Brackets rule box is similar to the Replace in Between, but for removing text in brackets. To remove the terms between two brackets:

  1. Go to Data View from the site's main menu.

  2. Choose the needed export channel or the intermediate stage in the drop-down menu on the left.

  3. Select Edit in the attribute's column where you want to apply the rule box.

  4. Select the Add Box drop-down menu.

  5. Search for and select the Remove Terms in Brackets rule box.

  6. Select Save to apply the rule.

replace_between_brackets.png

The Remove Terms in Brackets rule box result:

Before

After

This is a great t-shirt, the very best (endorsed by world-famous jazz saxophonist Joshua Redman).

This is a great t-shirt, the very best.