In this series of articles powered by Adaptavist, we explore several tips for making the most out of Confluence for your team – from meaningful content, to using templates and blueprints, to integrations and automations.
Confluence is your remote-friendly team workspace where knowledge and collaboration meet – if you’re new to this tool, read more about it here.


Below you will find guidance on how to find and replace text across several Confluence pages at once using a ScriptRunner script. This post includes a step by step video demo and the groovy code. Feel free to download it and use it for your own needs.

Confluence has a native find and replace feature (look for the magnifying glass at the right of the editor-panel), but it is pretty limited since it’s only for finding and replacing text on a single page.  

Imagine a space which has pages that contain tables with department names in their headers. A Confluence admin wants to abbreviate every occurrence of “Human Resources” in all table headers to “HR”.  The script below will only change the text “Human Resources” to “HR” when it is found in a table header, and leaves all other occurrences of “Human Resources” as they are. You can always make this more general and choose to simply replace all occurrences of whatever text you want to replace in a page.

For a one time use, run this script in ScriptRunner’s Script Console. This script was written with a one-time use in mind, but it can also be adapted to work with some of our built-in scripts or other ScriptRunner features, such as the CQL Service Escalation job.

find and replace 2

You could adjust this script to fit a wide variety of use cases, such as finding and replacing text on every page in a particular space, or any page that meets some other criteria. Additionally, as in this example, you may only want to replace particular occurrences of that text within a page. We hope that helps! Download the Groovy script file

Step by step guide

If you would like to watch a step by step video demo of what I described above, check out this video.

WATCH VIDEO

 

Other Articles

Discover the joy of collaborative working

We are your experienced and certified local partner and we are determined to find the best solution for your challenges. 

Download Resources

Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua...

    Email address

    Full name

    Company name

    Phone number