Class RegexTransformer

java.lang.Object
com.norconex.importer.handler.transformer.impl.RegexTransformer
All Implemented Interfaces:
Configurable<RegexTransformerConfig>, ConfigurableDocHandler<RegexTransformerConfig>, DocHandler

public class RegexTransformer extends Object implements ConfigurableDocHandler<RegexTransformerConfig>

Extracts field names and their values with regular expression. This is done by using match groups in your regular expressions (parenthesis). For each pattern you define, you can specify which match group hold the field name and which one holds the value. Specifying a field match group is optional if a field is provided. If no match groups are specified, a field is expected.

If "fieldMatcher" is specified, it will use content from matching fields and storing all text extracted into the target field, multi-value. Else, the document content is used.

Storing values in an existing field

If a target field with the same name already exists for a document, values will be added to the end of the existing value list. It is possible to change this default behavior by supplying a PropertySetter.

This class can be used as a pre-parsing handler on text documents only or a post-parsing handler.

See Also: