- [Case Studies](https://www.mergado.com/category/case-studies)
- [eCommerce tips](https://www.mergado.com/category/ecommerce-tips)
- [Online Store Solutions and Platforms](https://www.mergado.com/category/online-store-solutions-and-platforms)
- [Mergado Pack](https://www.mergado.com/category/mergado-pack)
- [Mergado tips](https://www.mergado.com/category/mergado-tips)
- [Mergado News](https://www.mergado.com/category/mergado-news)
- [eCommerce News](https://www.mergado.com/category/ecommerce-news)
- [How to use Mergado](https://www.mergado.com/category/how-to-use-mergado)
- [Interviews with e‑commerce gurus](https://www.mergado.com/category/interviews-e-commerce-gurus)
- [Extensions](https://www.mergado.com/category/apps-bidding-image-marketing-and-more)
- [Expansion with Mergado](https://www.mergado.com/category/expansion-with-mergado)
- [Mergado Lifestyle](https://www.mergado.com/category/mergado-lifestyle)
 



 

 1. [  Home  ](https://www.mergado.com/)
2. [     Mergado Blog  ](https://www.mergado.com/blog)
3. [     Case Studies  ](https://www.mergado.com/category/case-studies)
4. <a class="flex items-center gap-2 hover:underline" href="" itemid="" itemprop="item" itemscope="" itemtype="https://schema.org/Thing">    **Learn how to work with the Find and Replace rule. It speeds up your work in the feed** </a>
 
  

 

#  **Learn how to work with the Find and Replace rule. It speeds up your work in the feed** 

 

 

 [    ![](https://www.mergado.com/sites/default/files/perm/user-avatar/23021961102131189073595481259913287n.jpg)   Lukáš Horák  ](https://www.mergado.com/blog/lukas-horak) [Case Studies](https://www.mergado.com/category/case-studies) , [How to use Mergado](https://www.mergado.com/category/how-to-use-mergado) 

20. 10. 2020

3 minutes read

 

 

 

 

 

  ![Learn how to work with the Find and Replace rule. It speeds up your work in the feed](https://www.mergado.com/sites/default/files/field/image/find-and-replace.png)  

Set up advertising as you need by using **a handy tool for editing text** in an [XML feed](https://www.mergado.com/tag/xml-feed). With the *Find and Replace* rule, you can replace, remove, or fix bugs on products across the entire feed. Let’s show you how to use the [rule](https://www.mergado.com/tag/rules-in-mergado) and set it up for your online store.



 

 

 
                function tableOfContents() {
                  return {
                    headings_menu: [],
                    heading_active: '', // Added to track the active section
                    shouldBeSticky: false,

                    generateToC() {
                      const headings = document.querySelectorAll('.js-article-full-headings h2, .js-article-full-headings h3');
                      let headingMap = {};

                      headings.forEach((heading) => { // Use an arrow function to maintain `this` context
                        // Normalize heading text to remove diacritics, then replace non-alphanumeric characters with dashes
                        var normalizedText = heading.textContent.normalize("NFD").replace(/[\u0300-\u036f]/g, ""); // Remove diacritics
                        var id = heading.id ? heading.id : normalizedText.trim().toLowerCase()
                          .split(' ').join('-').replace(/[^a-z0-9\-]/ig, ''); // Updated regex to replace non-alphanumeric characters
                        headingMap[id] = headingMap[id] !== undefined ? ++headingMap[id] : 0;

                        // Use the updated `id` with diacritics removed for the heading id and the TOC
                        const finalId = headingMap[id] ? `${id}-${headingMap[id]}` : id;
                        this.headings_menu.push({
                          id: finalId,
                          title: heading.textContent,
                          level: heading.tagName.toLowerCase(), // Track heading level
                          active: false, // Initially set active to false
                        });
                        heading.id = finalId;
                      });
                    },

                    checkStickyNeeded() {
                      const ul = this.$el.querySelector('ul');
                      if (ul) {
                        this.shouldBeSticky = ul.scrollHeight < window.innerHeight;
                      }
                    },

                    setActiveHeading() {
                      // disabled not working with active state on click
                      // add @scroll.window="setActiveHeading()" to the parent div

                      // const headings = document.querySelectorAll('.js-article-full-headings h2');
                      // let activeHeading = '';
                      // let closestHeadingDistance = Infinity;

                      // headings.forEach((heading) => {
                      //   const rect = heading.getBoundingClientRect();
                      //   const offset = rect.top - window.innerHeight / 2; // Consider heading in the middle of the screen as active

                      //   if (offset < 0 && Math.abs(offset) < closestHeadingDistance) {
                      //     activeHeading = heading.id;
                      //     closestHeadingDistance = Math.abs(offset);
                      //   }
                      // });

                      // // Update the active state in headings_menu
                      // if (activeHeading !== this.heading_active) {
                      //   this.headings_menu = this.headings_menu.map(item => ({
                      //     ...item,
                      //     active: item.id === activeHeading,
                      //   }));
                      //   this.heading_active = activeHeading;

                      // }
                    },

                    setActiveItem(clickedId) {
                      this.headings_menu.forEach(item => {
                        item.active = (item.id === clickedId);
                      });
                      this.heading_active = clickedId; // Optionally update the heading_active property if used
                    },
                  };
                }
               1. <a :class="{ 'border-r-[3px] border-secondary': item.active, 'text-sm': item.level === 'h3' }" :href="'#' + item.id" class="inline-block text-balance hover:underline p-0.5 pr-3">  — </a>
  



 

Set up advertising as you need by using **a handy tool for editing text** in an [XML feed](https://www.mergado.com/tag/xml-feed). With the *Find and Replace* rule, you can replace, remove, or fix bugs on products across the entire feed. Let’s show you how to use the [rule](https://www.mergado.com/tag/rules-in-mergado) and set it up for your online store.

1. [Using the Find and Replace rule](#vyuziti_najit_a_nahradit)
2. [Applying the Find and Replace rule](#aplikace_najit_a_nahradit)

## <a id="vyuziti_najit_a_nahradit"></a>Using the Find and Replace rule

### 1. Replacing text with new content

Let’s look at the application of the *Find and Replace* rule. Example: you sell water filters, and you named a product as **XYZ Filter Cartridge** in the XML feed.

**Create a rule** that finds the phrase “Filter Cartridge” in the product names and replaces it with “Filter”.

1. In the Rules section, click the *New* *Rule* button.
2. Name the rule and select the *Find* *and* *Replace* rule type.
3. Select the element that contains the product description and enter the search text in the *Find* field.
4. Fill in the new required text in the *Replace* field.
5. Save the rule and check the new names in the *Products* section after regenerating the data.



 

 [  ![](https://www.mergado.com/sites/default/files/perm/paragraph-image/1exampleofusingthefindandreplaceruletochangetexts.png)  ](https://www.mergado.com/sites/default/files/perm/paragraph-image/1exampleofusingthefindandreplaceruletochangetexts.png) 

### 2. Translating the selected text and replacing it with a new one

You can also use the rule when **translating** **text** that you need to replace with a new one. To create it, follow the same procedure as for the previous text replacement.



 

 [  ![](https://www.mergado.com/sites/default/files/perm/paragraph-image/2exampleofusingthefindandreplaceruletotranslatetext.png)  ](https://www.mergado.com/sites/default/files/perm/paragraph-image/2exampleofusingthefindandreplaceruletotranslatetext.png) 

### 3. Deleting the unwanted text

The product name sometimes contains a term that **search engines do not support** – whether it is the word ACTION (XY filter – ACTION), the *exclamation* *mark* (XY filter !!!!), or the *domain* of your store (XY filter – www\_​filtersforeveryone\_​en). With the *Find and Replace* rule, you delete them.

1. **Select** products that contain the word ACTION in the name.
2. **Create** a new rule using the procedure above.
3. In the *Find* box, **type** the word ACTION and **leave** the *Replace* box blank. The ACTION word thus disappears from the name.



 

 [  ![](https://www.mergado.com/sites/default/files/perm/paragraph-image/3exampleofusingthefindandreplaceruletodeletetext.png)  ](https://www.mergado.com/sites/default/files/perm/paragraph-image/3exampleofusingthefindandreplaceruletodeletetext.png) 

### 4. Using a rule when creating macros

You can also use this rule in Mergado to [create your macros](https://www.mergado.com/custom-macros). They do not yet include the option of creating more *Find and Replace* pairs – we plan to add a function.



 

### 5. Replace the selected text with another using regular expressions

The rule also supports a quick search in the *Find* field using [regular expressions](https://www.mergado.com/tag/regular-expressions), including a **backreference** in the *Replace* field.



 

### 6. Setting up multiple pairs in one rule

Use this option to apply the *Find and Replace* rule to **multiple pairs at once**, and you don’t need to create separate rules for each combination. You can also use **regular** **expressions** for a quick search.



 

## <a id="aplikace_najit_a_nahradit"></a>Applying the Find and Replace rule

You can also set the rule **for specific product queries**. It brings benefits in the form of [improved speed](https://www.mergado.com/how-to-create-rules-correctly) when synchronizing the store and reducing the risk of errors when replacing text in other categories.

Make it easier to edit the feed with Mergado. Try it for 30 days for free.

[![](/sites/default/files/users/button-eng.png)](http://accounts.mergado.com/register/)

### **Read more:**



 

 [    ![](https://www.mergado.com/sites/default/files/perm/image/ai_boost-1.jpg)  

### MASTER PROMPT TEMPLATE FOR ECOMMERCE

 

 ](https://www.mergado.com/blog/master-prompt-eshopy-b2c) 

 [    ![](https://www.mergado.com/sites/default/files/perm/image/uawc_cs_en.jpg)  

### How Feed Optimization Unlocked Meta Ads Performance without Increasing Ad Spend

 

 ](https://www.mergado.com/blog/feed-optimization-for-meta-ads) 

 [    ![](https://www.mergado.com/sites/default/files/perm/image/how_to_sell_successfully_on_idealo.jpg)  

### How to Sell Successfully on idealo

 

 ](https://www.mergado.com/blog/successful-sale-on-idealo) 

 

 

 [    ![](https://www.mergado.com/sites/default/files/perm/user-avatar/23021961102131189073595481259913287n.jpg)  ](https://www.mergado.com/blog/lukas-horak)###  [ Lukáš Horák ](https://www.mergado.com/blog/lukas-horak) 

Lukáš takes care of most of the Czech and English communication in Mergado. Through blogs, e‑mail, and social networks, he regularly supplies readers with e‑commerce news and news and tips from Mergado. In his time off, he enjoys simple things like badminton, digging the hidden gems of the 80’s, and seafood served with red wine.

 

 

 

 

 

 

 

 

 

## What you *might be interested in next*

 

 [    ![](https://www.mergado.com/sites/default/files/perm/image/uawc_cs_en.jpg)  

### How Feed Optimization Unlocked Meta Ads Performance without Increasing Ad Spend

 

 ](https://www.mergado.com/blog/feed-optimization-for-meta-ads) 

 [    ![](https://www.mergado.com/sites/default/files/perm/image/effectix_jabkolevne_casestudy_en.jpg)  

### The Real Impact of Visual Product Image Optimization on Meta Campaign Performance

 

 ](https://www.mergado.com/blog/visuals-for-meta-campaigns) 

 [    ![](https://www.mergado.com/sites/default/files/perm/image/shoptet-shopify-prevod-en.jpg)  

### How We Migrated an E‑Shop from Shoptet to Shopify with Mergado: A Complete Migration Without Data Loss

 

 ](https://www.mergado.com/blog/how-we-migrated-e-shop-shoptet-shopify-mergado-complete-migration-without-data-loss) 

 

 

 

## Don’t miss *anything*

 Sign up for our newsletter 

   

       

   By logging in, you agree that we will process your data by the [terms of personal data protection](https://www.mergado.com/cookies). 

  Thank you, you have successfully joined our subscriber's list. 

 

 

 
      function ml_webform_success_5807248() {
        var r = ml_jQuery || jQuery
        r('.ml-subscribe-form-5807248 .row-success').show(), r('.ml-subscribe-form-5807248 .row-form').hide()
      }