RegexFieldValueExtractor
Extracts field names and values from text using a regular expression with capture groups.
Notesโ
Applies a regular expression to document content or metadata and uses capture groups to extract a field name and its corresponding value. The fieldGroup and valueGroup properties identify which capture groups hold the field name and value respectively, and the extracted value is stored in the field specified by toField.
Examplesโ
The following is configured to extract "DocNo" as the toField, and the following numeric characters will make up the value.
- YAML
- JSON
- XML
fieldGroup: 1
valueGroup: 2
regex:
pattern: (DocNo):(\d+)
{
"fieldGroup": 1,
"valueGroup": 2,
"regex": {
"pattern": "(DocNo):(\\d+)"
}
}
<fieldGroup>1</fieldGroup>
<valueGroup>2</valueGroup>
<regex>
<pattern>(DocNo):(\d+)</pattern>
</regex>
Usageโ
Full configuration skeleton, with every option and its default
- YAML
- JSON
- XML
fieldGroup: 0
onSet: APPEND
regex:
canonEq: false
comments: false
dotAll: false
ignoreCase: false
ignoreDiacritic: false
literal: false
matchEmpty: false
multiline: false
pattern: string
trim: false
unicodeCase: false
unicodeCharacterClass: false
unixLines: false
toField: string
valueGroup: 0
{
"fieldGroup": 0,
"onSet": "APPEND",
"regex": {
"canonEq": false,
"comments": false,
"dotAll": false,
"ignoreCase": false,
"ignoreDiacritic": false,
"literal": false,
"matchEmpty": false,
"multiline": false,
"pattern": "string",
"trim": false,
"unicodeCase": false,
"unicodeCharacterClass": false,
"unixLines": false
},
"toField": "string",
"valueGroup": 0
}
<regexFieldValueExtractor>
<fieldGroup>0</fieldGroup>
<onSet>APPEND</onSet>
<regex>
<canonEq>false</canonEq>
<comments>false</comments>
<dotAll>false</dotAll>
<ignoreCase>false</ignoreCase>
<ignoreDiacritic>false</ignoreDiacritic>
<literal>false</literal>
<matchEmpty>false</matchEmpty>
<multiline>false</multiline>
<pattern>string</pattern>
<trim>false</trim>
<unicodeCase>false</unicodeCase>
<unicodeCharacterClass>false</unicodeCharacterClass>
<unixLines>false</unixLines>
</regex>
<toField>string</toField>
<valueGroup>0</valueGroup>
</regexFieldValueExtractor>
Propertiesโ
| Property | Type | Required | Default |
|---|---|---|---|
fieldGroup | integer | No | -1 |
onSet | enum | No | - |
regex | Regex | No | Regex |
toField | string | No | - |
valueGroup | integer | No | -1 |
Property Detailsโ
fieldGroupโ
The index of the regex capture group that contains the field name. When specified along with toField, the toField value acts as the default when no match is found for this group.
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โ
APPENDPREPENDREPLACEOPTIONAL
regexโ
A regular expression pattern used for matching.
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.
valueGroupโ
The index of the regex capture group that contains the extracted value. If not specified, the entire regex match is used as the value.