Skip to main content

ReplaceOperation

A single value replacement operation for the ReplaceTransformer.

Notes

Defines a single replacement operation for the ReplaceTransformer. Specifies source fields, the value pattern to match, the replacement value, an optional target field, and whether to discard values that were not changed by the replacement.

Usage

discardUnchanged: false
fieldMatcher:
ignoreCase: false
ignoreDiacritic: false
matchEmpty: false
method: BASIC
negateMatches: false
partial: false
pattern: string
replaceAll: false
trim: false
onSet: APPEND
toField: string
toValue: string
valueMatcher:
ignoreCase: false
ignoreDiacritic: false
matchEmpty: false
method: BASIC
negateMatches: false
partial: false
pattern: string
replaceAll: false
trim: false

Properties

PropertyTypeRequiredDefault
discardUnchangedbooleanNofalse
fieldMatcherTextMatcherNoTextMatcher
onSetenumNo-
toFieldstringNo-
toValuestringNo-
valueMatcherTextMatcherNoTextMatcher

Property Details

discardUnchanged

Whether values left untouched by the replacement are dropped instead of kept. Default is false, which keeps every value whether it matched or not. Set it to true to end up with only the values that actually changed.

fieldMatcher

Matches document fields based on specified patterns and methods. Use this to restrict the handler to operate only on fields whose names satisfy the matcher criteria.

onSet

Defines what to do when the target field already has one or more values. When unspecified, new values are appended to existing ones by default.

Allowed Values

  • APPEND
  • PREPEND
  • REPLACE
  • OPTIONAL

toField

The target metadata field name where the extracted or computed value will be stored. If a field of the same name already exists, the behavior is controlled by onSet.

toValue

The replacement text for whatever valueMatcher matched. Treated as an empty string when unset, which deletes the matched portion. With a regular-expression valueMatcher, group references such as $1 are available.

valueMatcher

Matches document field values based on specified patterns and methods. Use this to restrict the handler to operate only on fields whose values satisfy the matcher criteria.