How to use findReplaceRegex to preserve whitespaces of a replacement string using Confluence CLI

This article explains how to preserve leading or trailing whitespaces through findReplaceRegex using the Confluence Command Line Interface (CLI) app.


Any element for which leading or trailing whitespaces must be preserved, must be kept within single quotes (').

As an example, let's use the modifyPage action with the findReplaceRegex parameter to modify a page title.

--action modifyPage --space "SPACEKEY" --title "Pagetitle" --findReplaceRegex "(Demospace):'\$1 and Bobswift '"

The parameter, if used with the single quote, looks like:

The parameter, if used without the single quote, looks like: