@EventDriven @SideEffectFree @SupportsBatching @InputRequirement(value=INPUT_REQUIRED) @Tags(value={"Text","Regular Expression","Update","Change","Replace","Modify","Regex"}) @CapabilityDescription(value="Updates the content of a FlowFile by evaluating a Regular Expression (regex) against it and replacing the section of the content that matches the Regular Expression with some alternate value.") @SystemResourceConsideration(resource=MEMORY) public class ReplaceText extends AbstractProcessor
Modifier and Type | Class and Description |
---|---|
private static class |
ReplaceText.AlwaysReplace |
private static class |
ReplaceText.AppendReplace |
private static class |
ReplaceText.LiteralReplace |
private static class |
ReplaceText.PrependReplace |
private static class |
ReplaceText.RegexReplace |
private static interface |
ReplaceText.ReplacementStrategyExecutor |
Constructor and Description |
---|
ReplaceText() |
Modifier and Type | Method and Description |
---|---|
protected Collection<ValidationResult> |
customValidate(ValidationContext validationContext) |
private static String |
escapeExpressionDollarSigns(String replacement)
If we have a '$' followed by anything other than a number, then escape
it if it is not already escaped.
|
private static String |
escapeForEvaluation(String contentString)
Escapes a
String containing literal('') EL values. |
private static String |
escapeLiteralBackReferences(String unescaped,
int numCapturingGroups) |
Set<Relationship> |
getRelationships() |
protected List<PropertyDescriptor> |
getSupportedPropertyDescriptors() |
protected void |
init(ProcessorInitializationContext context) |
void |
onTrigger(ProcessContext context,
ProcessSession session) |
private static String |
wrapLiterals(String possibleLiteral)
Wraps '$1' with the
literal function for EL evaluation. |
onTrigger
getControllerServiceLookup, getIdentifier, getLogger, getNodeTypeProvider, initialize, isConfigurationRestored, isScheduled, toString, updateConfiguredRestoredTrue, updateScheduledFalse, updateScheduledTrue
equals, getPropertyDescriptor, getPropertyDescriptors, getSupportedDynamicPropertyDescriptor, hashCode, onPropertyModified, validate
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
getPropertyDescriptor, getPropertyDescriptors, onPropertyModified, validate
private static Pattern QUOTED_GROUP_REF_PATTERN
private static Pattern DOUBLE_QUOTED_GROUP_REF_PATTERN
private static Pattern LITERAL_QUOTED_PATTERN
public static final String LINE_BY_LINE
public static final String ENTIRE_TEXT
public static final String prependValue
public static final String appendValue
public static final String regexReplaceValue
public static final String literalReplaceValue
public static final String alwaysReplace
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 LITERAL_REPLACE
static final AllowableValue REGEX_REPLACE
static final AllowableValue ALWAYS_REPLACE
public static final PropertyDescriptor SEARCH_VALUE
public static final PropertyDescriptor REPLACEMENT_VALUE
public static final PropertyDescriptor CHARACTER_SET
public static final PropertyDescriptor MAX_BUFFER_SIZE
public static final PropertyDescriptor REPLACEMENT_STRATEGY
public static final PropertyDescriptor EVALUATION_MODE
public static final Relationship REL_SUCCESS
public static final Relationship REL_FAILURE
private List<PropertyDescriptor> properties
private Set<Relationship> relationships
protected void init(ProcessorInitializationContext context)
init
in class AbstractSessionFactoryProcessor
protected List<PropertyDescriptor> getSupportedPropertyDescriptors()
getSupportedPropertyDescriptors
in class AbstractConfigurableComponent
public Set<Relationship> getRelationships()
getRelationships
in interface Processor
getRelationships
in class AbstractSessionFactoryProcessor
protected Collection<ValidationResult> customValidate(ValidationContext validationContext)
customValidate
in class AbstractConfigurableComponent
public void onTrigger(ProcessContext context, ProcessSession session) throws ProcessException
onTrigger
in class AbstractProcessor
ProcessException
private static String escapeLiteralBackReferences(String unescaped, int numCapturingGroups)
private static String wrapLiterals(String possibleLiteral)
literal
function for EL evaluation.possibleLiteral
- the String
to evaluate.String
with literals wrapped. If no literals or Expression Lanaguage present the passed string
is returned.private static String escapeExpressionDollarSigns(String replacement)
Copyright © 2018 Apache NiFi Project. All rights reserved.