Mark Payne created NIFI-9490:
--------------------------------
Summary: Add a 'Use Expression Language' Replacement Strategy to
ReplaceText
Key: NIFI-9490
URL: https://issues.apache.org/jira/browse/NIFI-9490
Project: Apache NiFi
Issue Type: Improvement
Components: Extensions
Reporter: Mark Payne
When we have data that requires multiple transformations, the typical solution
is to chain together multiple instances of ReplaceText. But this is expensive.
It has to read & write the content multiple times. We also have to use Regex
and are limited in the types of transformations that we can perform.
We should add a new Replacement Strategy of "Use Expression Language." When
selected, the Search Value should be ignored (and should be hidden via
dependent properties). The Replacement Value should allow for Expression
Language and should be provided FlowFile attributes as well as a variable named
text that is to be evaluated. If the Evaluate Mode is Line-by-Line, it should
also be provided a variable named lineNo that indicates the 1-based line number
that is being evaluated.
This allows for powerful transformations, such as:
{\{ ${text:toUpper()} }} to make the line uppercase
{\{ ${lineNo}: ${text} }} to prepend each line of text with a line number
followed by a colon
And many other possibilities that are not easily available today.
--
This message was sent by Atlassian Jira
(v8.20.1#820001)