@EventDriven @SideEffectFree @SupportsBatching(defaultDuration=TWENTY_FIVE_MILLIS) @InputRequirement(value=INPUT_REQUIRED) @Tags(value={"Text","Regular Expression","Update","Change","Replace","Modify","Regex"}) @CapabilityDescription(value="Updates the content of a FlowFile by searching for some textual value in the FlowFile content (via Regular Expression/regex, or literal value) and replacing the section of the content that matches with some alternate value. It can also be used to append or prepend text to the contents of a FlowFile.") @SystemResourceConsideration(resource=MEMORY) public class ReplaceText extends AbstractProcessor
| Modifier and Type | Class and Description |
|---|---|
private static class |
ReplaceText.AlwaysReplace |
private static class |
ReplaceText.LiteralReplace |
private static class |
ReplaceText.PrependReplace |
private static class |
ReplaceText.RegexReplace |
private static interface |
ReplaceText.ReplaceLine |
private static interface |
ReplaceText.ReplacementStrategyExecutor |
private static class |
ReplaceText.StreamReplaceCallback |
private static class |
ReplaceText.SubstituteVariablesReplace |
private static class |
ReplaceText.SurroundReplace |
| Constructor and Description |
|---|
ReplaceText() |
| Modifier and Type | Method and Description |
|---|---|
protected Collection<ValidationResult> |
customValidate(ValidationContext validationContext) |
private static String |
escapeLiteralBackReferences(String unescaped,
int numCapturingGroups) |
Set<Relationship> |
getRelationships() |
protected List<PropertyDescriptor> |
getSupportedPropertyDescriptors() |
protected void |
init(ProcessorInitializationContext context) |
private static String |
normalizeReplacementString(String replacement)
If we have a '$' followed by anything other than a number, then escape
it.
|
void |
onTrigger(ProcessContext context,
ProcessSession session) |
void |
setup(ProcessContext context) |
onTriggergetControllerServiceLookup, getIdentifier, getLogger, getNodeTypeProvider, initialize, isConfigurationRestored, isScheduled, toString, updateConfiguredRestoredTrue, updateScheduledFalse, updateScheduledTrueequals, getPropertyDescriptor, getPropertyDescriptors, getSupportedDynamicPropertyDescriptor, hashCode, onPropertyModified, validateclone, finalize, getClass, notify, notifyAll, wait, wait, waitisStatefulgetPropertyDescriptor, getPropertyDescriptors, onPropertyModified, validateprivate static Pattern REPLACEMENT_NORMALIZATION_PATTERN
public static final String LINE_BY_LINE
public static final String ALL
public static final String FIRST_LINE
public static final String EXCEPT_FIRST_LINE
public static final String LAST_LINE
public static final String EXCEPT_LAST_LINE
public static final String ENTIRE_TEXT
public static final String prependValue
public static final String appendValue
public static final String surroundValue
public static final String regexReplaceValue
public static final String literalReplaceValue
public static final String alwaysReplace
public static final String SUBSTITUTE_VARIABLES_VALUE
private static final Pattern unescapedBackReferencePattern
private static final String DEFAULT_REGEX
private static final String DEFAULT_REPLACEMENT_VALUE
static final AllowableValue PREPEND
static final AllowableValue APPEND
static final AllowableValue SURROUND
static final AllowableValue LITERAL_REPLACE
static final AllowableValue REGEX_REPLACE
static final AllowableValue ALWAYS_REPLACE
static final AllowableValue SUBSTITUTE_VARIABLES
public static final PropertyDescriptor REPLACEMENT_STRATEGY
public static final PropertyDescriptor SEARCH_VALUE
public static final PropertyDescriptor REPLACEMENT_VALUE
static final PropertyDescriptor PREPEND_TEXT
static final PropertyDescriptor APPEND_TEXT
public static final PropertyDescriptor CHARACTER_SET
public static final PropertyDescriptor MAX_BUFFER_SIZE
public static final PropertyDescriptor EVALUATION_MODE
public static final PropertyDescriptor LINE_BY_LINE_EVALUATION_MODE
public static final Relationship REL_SUCCESS
public static final Relationship REL_FAILURE
private List<PropertyDescriptor> properties
private Set<Relationship> relationships
private ReplaceText.ReplacementStrategyExecutor replacementStrategyExecutor
protected void init(ProcessorInitializationContext context)
init in class AbstractSessionFactoryProcessorprotected List<PropertyDescriptor> getSupportedPropertyDescriptors()
getSupportedPropertyDescriptors in class AbstractConfigurableComponentpublic Set<Relationship> getRelationships()
getRelationships in interface ProcessorgetRelationships in class AbstractSessionFactoryProcessorprotected Collection<ValidationResult> customValidate(ValidationContext validationContext)
customValidate in class AbstractConfigurableComponent@OnScheduled public void setup(ProcessContext context)
public void onTrigger(ProcessContext context, ProcessSession session) throws ProcessException
onTrigger in class AbstractProcessorProcessExceptionprivate static String escapeLiteralBackReferences(String unescaped, int numCapturingGroups)
Copyright © 2023 Apache NiFi Project. All rights reserved.