2022.1

Table Of Contents
Advanced Search and Replace
Advanced Search and Replace action tasks are used to locate and replace strings of data
within the job file and to replace them with other strings of data. Contrary to Search and
Replace action tasks, they allow the use of regular expressions.
Using regular expressions, it is possible to search for patterns rather than specific strings. For
instance, a pattern can be specified to find all valid email addresses or phone numbers within
the data stream.
In a regular expression, substrings can be captured as groups using parentheses. Values of
capturing groups - the matched substrings - can then be included in the replacement string
using the dollar sign syntax: $1 ... $9. The numbering follows the order in which groups appear
in the search string.
For example, in order to replace all instances of "Page x/y" (Page 1/3, Page 2/3, etc.) in a
document with "Page x of y total pages", the regular expression would have to contain
parentheses to capture the values of x and y: Page\s(\d*)\/(\d*). The first capturing group,
(\d*), contains the value of x, the second the value of y.
The replacement string would then be: Page $1 of $2 total pages (where $1 contains x, and
$2 contains y).
For more information about regular expressions, visit a website like https://www.regular-
expressions.info/.
To test out your regular expressions go to: https://regex101.com/.
Input
Any text-based file can be used in this task, even formats that are not directly compatible with
PlanetPress Workflow. As long as the text is visible in a text-based editor (such as Notepad), it
is readable and supported by this task.
Processing
The appropriate changes are made to the data file (replacing text).
Output
The modified data file is output from this task. Metadata is not modified in any way if it is
present.
Page 378