Class ExtractText
java.lang.Object
org.apache.nifi.components.AbstractConfigurableComponent
org.apache.nifi.processor.AbstractSessionFactoryProcessor
org.apache.nifi.processor.AbstractProcessor
org.apache.nifi.processors.standard.ExtractText
- All Implemented Interfaces:
org.apache.nifi.components.ConfigurableComponent,org.apache.nifi.processor.Processor
@SideEffectFree
@SupportsBatching
@InputRequirement(INPUT_REQUIRED)
@Tags({"evaluate","extract","Text","Regular Expression","regex"})
@CapabilityDescription("Evaluates one or more Regular Expressions against the content of a FlowFile. The results of those Regular Expressions are assigned to FlowFile Attributes. Regular Expressions are entered by adding user-defined properties; the name of the property maps to the Attribute Name into which the result will be placed. The attributes are generated differently based on the enabling of named capture groups. If named capture groups are not enabled: The first capture group, if any found, will be placed into that attribute name.But all capture groups, including the matching string sequence itself will also be provided at that attribute name with an index value provided, with the exception of a capturing group that is optional and does not match - for example, given the attribute name \"regex\" and expression \"abc(def)?(g)\" we would add an attribute \"regex.1\" with a value of \"def\" if the \"def\" matched. If the \"def\" did not match, no attribute named \"regex.1\" would be added but an attribute named \"regex.2\" with a value of \"g\" will be added regardless.If named capture groups are enabled: Each named capture group, if found will be placed into the attributes name with the name provided. If enabled the matching string sequence itself will be placed into the attribute name. If multiple matches are enabled, and index will be applied after the first set of matches. The exception is a capturing group that is optional and does not match For example, given the attribute name \"regex\" and expression \"abc(?<NAMED>def)?(?<NAMED-TWO>g)\" we would add an attribute \"regex.NAMED\" with the value of \"def\" if the \"def\" matched. We would add an attribute \"regex.NAMED-TWO\" with the value of \"g\" if the \"g\" matched regardless. The value of the property must be a valid Regular Expressions with one or more capturing groups. If named capture groups are enabled, all capture groups must be named. If they are not, then the processor configuration will fail validation. If the Regular Expression matches more than once, only the first match will be used unless the property enabling repeating capture group is set to true. If any provided Regular Expression matches, the FlowFile(s) will be routed to \'matched\'. If no provided Regular Expression matches, the FlowFile will be routed to \'unmatched\' and no attributes will be applied to the FlowFile.")
@DynamicProperty(name="A FlowFile attribute",
value="A Regular Expression with one or more capturing group",
description="The first capture group, if any found, will be placed into that attribute name.But all capture groups, including the matching string sequence itself will also be provided at that attribute name with an index value provided.")
public class ExtractText
extends org.apache.nifi.processor.AbstractProcessor
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final BlockingQueue<byte[]> static final org.apache.nifi.components.PropertyDescriptorstatic final org.apache.nifi.components.PropertyDescriptorstatic final org.apache.nifi.components.PropertyDescriptorstatic final org.apache.nifi.components.PropertyDescriptorprivate final AtomicReference<Map<String, Pattern>> static final org.apache.nifi.components.PropertyDescriptorstatic final org.apache.nifi.components.PropertyDescriptorstatic final org.apache.nifi.components.PropertyDescriptorstatic final org.apache.nifi.components.PropertyDescriptorstatic final org.apache.nifi.components.PropertyDescriptorstatic final org.apache.nifi.components.PropertyDescriptorstatic final org.apache.nifi.components.PropertyDescriptorstatic final org.apache.nifi.components.PropertyDescriptorprivate static final List<org.apache.nifi.components.PropertyDescriptor> static final org.apache.nifi.processor.Relationshipstatic final org.apache.nifi.processor.Relationshipprivate static final Set<org.apache.nifi.processor.Relationship> static final org.apache.nifi.components.PropertyDescriptorstatic final org.apache.nifi.components.PropertyDescriptorstatic final org.apache.nifi.components.PropertyDescriptor -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected Collection<org.apache.nifi.components.ValidationResult> customValidate(org.apache.nifi.components.ValidationContext validationContext) (package private) intgetCompileFlags(org.apache.nifi.processor.ProcessContext context) Set<org.apache.nifi.processor.Relationship> protected org.apache.nifi.components.PropertyDescriptorgetSupportedDynamicPropertyDescriptor(String propertyDescriptorName) protected List<org.apache.nifi.components.PropertyDescriptor> voidfinal voidonScheduled(org.apache.nifi.processor.ProcessContext context) voidvoidonTrigger(org.apache.nifi.processor.ProcessContext context, org.apache.nifi.processor.ProcessSession session) Methods inherited from class org.apache.nifi.processor.AbstractProcessor
onTriggerMethods inherited from class org.apache.nifi.processor.AbstractSessionFactoryProcessor
getControllerServiceLookup, getIdentifier, getLogger, getNodeTypeProvider, init, initialize, isConfigurationRestored, isScheduled, toString, updateConfiguredRestoredTrue, updateScheduledFalse, updateScheduledTrueMethods inherited from class org.apache.nifi.components.AbstractConfigurableComponent
equals, getPropertyDescriptor, getPropertyDescriptors, hashCode, onPropertyModified, validateMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.apache.nifi.components.ConfigurableComponent
getPropertyDescriptor, getPropertyDescriptors, onPropertyModified, validateMethods inherited from interface org.apache.nifi.processor.Processor
isStateful, migrateRelationships
-
Field Details
-
CHARACTER_SET
public static final org.apache.nifi.components.PropertyDescriptor CHARACTER_SET -
MAX_BUFFER_SIZE
public static final org.apache.nifi.components.PropertyDescriptor MAX_BUFFER_SIZE -
MAX_CAPTURE_GROUP_LENGTH
public static final org.apache.nifi.components.PropertyDescriptor MAX_CAPTURE_GROUP_LENGTH -
CANON_EQ
public static final org.apache.nifi.components.PropertyDescriptor CANON_EQ -
CASE_INSENSITIVE
public static final org.apache.nifi.components.PropertyDescriptor CASE_INSENSITIVE -
COMMENTS
public static final org.apache.nifi.components.PropertyDescriptor COMMENTS -
DOTALL
public static final org.apache.nifi.components.PropertyDescriptor DOTALL -
LITERAL
public static final org.apache.nifi.components.PropertyDescriptor LITERAL -
MULTILINE
public static final org.apache.nifi.components.PropertyDescriptor MULTILINE -
UNICODE_CASE
public static final org.apache.nifi.components.PropertyDescriptor UNICODE_CASE -
UNICODE_CHARACTER_CLASS
public static final org.apache.nifi.components.PropertyDescriptor UNICODE_CHARACTER_CLASS -
UNIX_LINES
public static final org.apache.nifi.components.PropertyDescriptor UNIX_LINES -
INCLUDE_CAPTURE_GROUP_ZERO
public static final org.apache.nifi.components.PropertyDescriptor INCLUDE_CAPTURE_GROUP_ZERO -
ENABLE_REPEATING_CAPTURE_GROUP
public static final org.apache.nifi.components.PropertyDescriptor ENABLE_REPEATING_CAPTURE_GROUP -
ENABLE_NAMED_GROUPS
public static final org.apache.nifi.components.PropertyDescriptor ENABLE_NAMED_GROUPS -
PROPERTY_DESCRIPTORS
-
REL_MATCH
public static final org.apache.nifi.processor.Relationship REL_MATCH -
REL_NO_MATCH
public static final org.apache.nifi.processor.Relationship REL_NO_MATCH -
RELATIONSHIPS
-
bufferQueue
-
compiledPattersMapRef
-
-
Constructor Details
-
ExtractText
public ExtractText()
-
-
Method Details
-
getRelationships
- Specified by:
getRelationshipsin interfaceorg.apache.nifi.processor.Processor- Overrides:
getRelationshipsin classorg.apache.nifi.processor.AbstractSessionFactoryProcessor
-
getSupportedPropertyDescriptors
- Overrides:
getSupportedPropertyDescriptorsin classorg.apache.nifi.components.AbstractConfigurableComponent
-
migrateProperties
-
getSupportedDynamicPropertyDescriptor
protected org.apache.nifi.components.PropertyDescriptor getSupportedDynamicPropertyDescriptor(String propertyDescriptorName) - Overrides:
getSupportedDynamicPropertyDescriptorin classorg.apache.nifi.components.AbstractConfigurableComponent
-
customValidate
protected Collection<org.apache.nifi.components.ValidationResult> customValidate(org.apache.nifi.components.ValidationContext validationContext) - Overrides:
customValidatein classorg.apache.nifi.components.AbstractConfigurableComponent
-
onScheduled
@OnScheduled public final void onScheduled(org.apache.nifi.processor.ProcessContext context) throws IOException - Throws:
IOException
-
onStopped
@OnStopped public void onStopped() -
onTrigger
public void onTrigger(org.apache.nifi.processor.ProcessContext context, org.apache.nifi.processor.ProcessSession session) - Specified by:
onTriggerin classorg.apache.nifi.processor.AbstractProcessor
-
getCompileFlags
int getCompileFlags(org.apache.nifi.processor.ProcessContext context)
-