---
title: "Use regex to remove Include macro from space(s) using Confluence CLI"
canonical: "https://support.appfire.com/space/SUPPORT/89135233/Use%20regex%20to%20remove%20Include%20macro%20from%20space(s)%20using%20Confluence%20CLI"
format: markdown
---
## <span style="color: #000000">Overview</span>

<span style="color: #000000">This article describes the steps involved in removing a macro from one or more spaces through regex patterns using the Confluence Command Line Interface (CLI).</span>

## <span style="color: #000000">Step-by-step guide</span>

<span style="color: #000000">You can remove a macro by using the </span>**<span style="color: #000000">runFromPageList</span>**<span style="color: #000000"> and </span>**<span style="color: #000000">modifyPage</span>**<span style="color: #000000"> actions. You can choose between the two actions based on your needs. </span>

> ✅ - <span style="color: #000000">The </span>**<span style="color: #000000">runFromPageList</span>**<span style="color: #000000"> action allows you to search for the page as per the specified criteria.</span>
> ✅ - <span style="color: #000000">The </span>**<span style="color: #000000">modifyPage</span>**<span style="color: #000000"> action allows you to modify the storage format of the page and remove the Include macro from all the pages in a space.</span>

1. <span style="color: #000000">Ensure that you update the confluence.sh/confluence.bat file with the server, user, and password details. </span>
2. <span style="color: #000000">To remove an Include Macro from all the pages in a space, execute the following CLI command: </span>
  <span style="color: #000000">Replace the space name with the intended name of the space in the above syntax.</span>
3. <span style="color: #000000">To remove a Macro from all the pages on a Confluence site, execute the following CLI command:</span>

> ✅ <span style="color: #000000">If you want to remove other macros from the page(s), you need to specify a different regex pattern. Please refer to </span>[How to use regular expression](https://bobswift.atlassian.net/wiki/spaces/info/pages/44695583/How+to+use+regular+expressions)<span style="color: #000000"> for further details.</span>


> ⚠️ - <span style="color: #000000">We highly recommend that you test the actions on a test instance before executing it in the production environment. </span>
> ⚠️ - <span style="color: #000000">As a precautionary measure, take a back up of the instance before executing the command.</span>