StripBeforeTransformer
Removes all content preceding the first occurrence of the specified pattern.
Notes
This class can be used as a pre-parsing (text content-types only) or post-parsing handlers.
Examples
The above example will strip all text up to and including this HTML comment: >!-- HEADER_END --<.
- YAML
- JSON
- XML
handler:
class: StripBeforeTransformer
inclusive: true
stripBeforeMatcher:
method: REGEX
pattern: <![CDATA[<!-- HEADER_END -->]]>
{
"handler": {
"class": "StripBeforeTransformer",
"inclusive": true,
"stripBeforeMatcher": {
"method": "REGEX",
"pattern": "<![CDATA[<!-- HEADER_END -->]]>"
}
}
}
<handler>
<class>StripBeforeTransformer</class>
<inclusive>true</inclusive>
<stripBeforeMatcher>
<method>REGEX</method>
<pattern><![CDATA[<!-- HEADER_END -->]]></pattern>
</stripBeforeMatcher>
</handler>
Usage
Full configuration skeleton, with every option and its default
- YAML
- JSON
- XML
class: StripBeforeTransformer
fieldMatcher:
ignoreCase: false
ignoreDiacritic: false
matchEmpty: false
method: BASIC
negateMatches: false
partial: false
pattern: string
replaceAll: false
trim: false
inclusive: false
label: string
maxReadSize: 0
sourceCharset: string
stripBeforeMatcher:
ignoreCase: false
ignoreDiacritic: false
matchEmpty: false
method: BASIC
negateMatches: false
partial: false
pattern: string
replaceAll: false
trim: false
{
"class": "StripBeforeTransformer",
"fieldMatcher": {
"ignoreCase": false,
"ignoreDiacritic": false,
"matchEmpty": false,
"method": "BASIC",
"negateMatches": false,
"partial": false,
"pattern": "string",
"replaceAll": false,
"trim": false
},
"inclusive": false,
"label": "string",
"maxReadSize": 0,
"sourceCharset": "string",
"stripBeforeMatcher": {
"ignoreCase": false,
"ignoreDiacritic": false,
"matchEmpty": false,
"method": "BASIC",
"negateMatches": false,
"partial": false,
"pattern": "string",
"replaceAll": false,
"trim": false
}
}
<handler>
<class>StripBeforeTransformer</class>
<fieldMatcher>
<ignoreCase>false</ignoreCase>
<ignoreDiacritic>false</ignoreDiacritic>
<matchEmpty>false</matchEmpty>
<method>BASIC</method>
<negateMatches>false</negateMatches>
<partial>false</partial>
<pattern>string</pattern>
<replaceAll>false</replaceAll>
<trim>false</trim>
</fieldMatcher>
<inclusive>false</inclusive>
<label>string</label>
<maxReadSize>0</maxReadSize>
<sourceCharset>string</sourceCharset>
<stripBeforeMatcher>
<ignoreCase>false</ignoreCase>
<ignoreDiacritic>false</ignoreDiacritic>
<matchEmpty>false</matchEmpty>
<method>BASIC</method>
<negateMatches>false</negateMatches>
<partial>false</partial>
<pattern>string</pattern>
<replaceAll>false</replaceAll>
<trim>false</trim>
</stripBeforeMatcher>
</handler>
Properties
| Property | Type | Required | Default |
|---|---|---|---|
fieldMatcher | TextMatcher | No | TextMatcher |
inclusive | boolean | No | false |
label | string | No | - |
maxReadSize | integer | No | 10000000 |
sourceCharset | string | No | - |
stripBeforeMatcher | TextMatcher | No | TextMatcher |
Property Details
fieldMatcher
Matches document fields based on specified patterns and methods
inclusive
Whether the matched text is stripped along with everything before it. Default is false, which strips up to the match and leaves the match itself in place.
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
sourceCharset
Sets the character encoding of the source document to ensure proper reading and processing.
stripBeforeMatcher
Specifies the pattern to match for stripping content before.