[ 
https://issues.apache.org/jira/browse/NIFI-4272?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16610783#comment-16610783
 ] 

ASF subversion and git services commented on NIFI-4272:
-------------------------------------------------------

Commit 0274bd4ff3f4199838ff1307c9c01d98fcc9150b in nifi's branch 
refs/heads/master from [~markap14]
[ https://git-wip-us.apache.org/repos/asf?p=nifi.git;h=0274bd4 ]

Revert "NIFI-4272 support multiple captures when EL is present in replacement 
value"

This reverts commit f7f809c3d3632eea5234b31740984b73de322464.

NIFI-5474, NIFI-4272: When using Regex Replace with ReplaceText, and there are 
capturing groups, ensure that we populate the 'additionalVariables' map for 
each match of the regex. This allows Expression Language to reference the 
back-references properly even when there are multiple matches

Signed-off-by: Matthew Burgess <[email protected]>

This closes #2951


> ReplaceText processor does not properly iterate multiple replacement values 
> when EL is used
> -------------------------------------------------------------------------------------------
>
>                 Key: NIFI-4272
>                 URL: https://issues.apache.org/jira/browse/NIFI-4272
>             Project: Apache NiFi
>          Issue Type: Bug
>          Components: Core Framework
>    Affects Versions: 1.1.0, 1.2.0, 1.3.0
>            Reporter: Matthew Clarke
>            Assignee: Otto Fowler
>            Priority: Major
>             Fix For: 1.7.0
>
>
> I am using the ReplaceText processor to take a string input (example:   
> {"name":"Smith","middle":"nifi","firstname":"John"} ) and change all the 
> filed names to all uppercase.
> Using above input as an example, I expect output like 
> {"NAME":"Smith","MIDDLE":"nifi","FIRSTNAME":"John"}
> I expect I should be able to do this with ReplaceText processor; however, I 
> see some unexpected behavior:
> -------
> Test 1:  (uses EL in the replacement value property)
> Search value:  \"([a-z]+?)\":\"(.+?)\"
> Replacement Value: \"*${'$1':toUpper()}*":\"$2\"
> Result: {"NAME":"Smith","NAME":"nifi","NAME":"John"}
> -------
> Test 2:  (Does not use EL in the replacement Value property)
> Search value:  \"([a-z]+?)\":\"(.+?)\"
> Replacement Value: \"new$1":\"$2\"
> Result: {"newname":"Smith","newmiddle":"nifi","newfirstname":"John"}
> --------
> As you can see if I use a NiFi expression Language statement in the 
> Replacement Value property it no longer iterates as expect through the 
> various $1 captured values. It repeatedly uses the EL result from the first 
> EL evaluation in every iteration while $2 correctly iterates through the 
> search values.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to