Find XXX in the content and replace it with YYY. The find replace parameter is made of a pair of strings separated by a : (colon). The first element is the string to find and the second element is the replacement string.
Multiple
No Format
--findReplace AAA:BBB
,
--findReplace XXX:YYY
More generally, the findReplace parameter is a comma separated lists of find replace pairsMultiple findReplace parameters can be used.
Regex
No Format
--findReplaceRegex XXX-(\d+):YYY-$1
Regular expressions provide even more powerful capabilities for finding and replacing text. In this case the first element of the pair must be a valid regex expression and the second element of the pair can use replacement variables ($1, $2, ...) to represent capture groups. See How to use regular expressions and the reference links.
Blanks
No Format
--findReplace "AAA BBB:YYY ZZZ"
Just like any other CLI parameter. If it contains blanks, it must be double quoted and embedded double quotes must be handled. See Tips.
Separators and quotes
No Format
--findReplace 'AAA:BBB':YYY
No Format
--findReplace "'AAA,BBB:YYY,ZZZ'"
Just like other separated list parameters, if a separator is part of the text, then the element must be single quoted. SeeĀ Tips.
Similarly embedded double quotes must be handled. SeeĀ Tips.
If the element values contain lots of separators and/or quotes, it gets really complicated and difficult to read. The special parameter provides relief by allowing you to use different separator and quoting characters to be recognized instead so your element text can be used directly with modification. Confluence storage format is one of the worse case examples of this so use of the special parameter is highly recommended for these scenarios. See the special parameter section of Tipsfor examples.
Example Usage
Table plus
autoNumber
true
Use
Discussion
run
The run action can run a list of actions provided in a file. This can be parameterized by using findReplace.
copyPages
The Confluence CLI copyPageaction can be used to copy a page hierarchy (used as a template) to create new pages using findReplace to automatically modify the contents on the copy.
modifyPage
The Confluence CLI modifyPageaction can modify existing page content using findReplace logic.