Skip to content

ReplaceText

Replaces text in content using literal or regex matching.

Parameters

NameDescriptionAllowed ValuesRequiredDefault
contentIndexesList of content indexes to include or excludeinteger (list)
contentTagsList of content tags to include or exclude, matching anystring (list)
excludeContentIndexesExclude specified content indexesbooleanfalse
excludeContentTagsExclude specified content tagsbooleanfalse
excludeFilePatternsExclude specified file patternsbooleanfalse
excludeMediaTypesExclude specified media typesbooleanfalse
filePatternsList of file patterns to include or exclude, supporting wildcards (*)string (list)
mediaTypesList of media types to consider, supporting wildcards (*)string (list)text/*
regexUse regex matching instead of literal textbooleanfalse
replacementReplacement text (supports $1, $2, etc. for regex capture groups)string
replaceFirstReplace only the first occurrence (default replaces all)booleanfalse
retainExistingContentRetain the existing contentbooleanfalse
searchValueText or regex pattern to findstring

Input

Content

Input content to act on may be selected (or inversely selected using the exclude parameters) with contentIndexes, mediaTypes, and/or filePatterns. If any of these are set and the content is not matched, the content is passed through unchanged.

Output

Content

Replaces text in each selected content. By default, replaces all occurrences of the search value. Set replaceFirst to true to replace only the first occurrence.

When regex is true, the searchValue is treated as a Java regular expression and the replacement can use $1, $2, etc. to reference capture groups.

If retainExistingContent is true, each content will be retained, followed by its transformed content.

Errors

  • On invalid regex pattern
  • On failure to process any content

Contact US