Skip to main content

StripBetweenTransformer

Removes any content found between a matching start and end strings.

Notes

The matching strings are defined in pairs and multiple ones can be specified at once.

This class can be used as a pre-parsing (text content-types only) or post-parsing handlers.

Examples

The following will strip all text between (and including) these two HTML comments: <!-- SIDENAV_START --> and <!-- SIDENAV_END -->.

handler:
class: StripBetweenTransformer
operations:
- inclusive: true
startMatcher:
method: REGEX
pattern: <![CDATA[<!-- SIDENAV_START -->]]>
endMatcher:
method: REGEX
pattern: <![CDATA[<!-- SIDENAV_END -->]]>

Usage

Full configuration skeleton, with every option and its default
class: StripBetweenTransformer
fieldMatcher:
ignoreCase: false
ignoreDiacritic: false
matchEmpty: false
method: BASIC
negateMatches: false
partial: false
pattern: string
replaceAll: false
trim: false
label: string
maxReadSize: 0
operations:
- endMatcher: {}
inclusive: false
startMatcher: {}
sourceCharset: string

Properties

PropertyTypeRequiredDefault
fieldMatcherTextMatcherNoTextMatcher
labelstringNo-
maxReadSizeintegerNo10000000
operationsStripBetweenOperation[]No-
sourceCharsetstringNo-

Property Details

fieldMatcher

Matches document fields based on specified patterns and methods

label

An optional, user-supplied label for this step in the importer pipeline. It has no effect on processing — it exists purely to help identify this step, for example in large configurations or in the visual configurator.

maxReadSize

Max characters to read at once

operations

Allows defining multiple operations as a list.

sourceCharset

Sets the character encoding of the source document to ensure proper reading and processing.