Sebastian Schlitte created NIFI-5369:
----------------------------------------

             Summary: ReplaceText not replacing all references to capture groups
                 Key: NIFI-5369
                 URL: https://issues.apache.org/jira/browse/NIFI-5369
             Project: Apache NiFi
          Issue Type: Bug
          Components: Extensions
    Affects Versions: 1.7.0
            Reporter: Sebastian Schlitte


||Property||Value||
|Search 
Value|(^.*\"type\"\:\"([0-9A-Za-z\-]*).*\})\,\"timestamp\"\:[\s]*([0-9]*).*\"\~event_uuid\"\:[\s]*\"([0-9A-Za-z\-\.]*).*$|
|Replacement 
Value|{"index":\{"_index":"${'$2'}-${'$3':format('yyyy.MM.dd')}","_type":"${'$2'}","_id":"${'$4'}"}}
$1|
|Character Set|UTF-8|
|Maximum Buffer Size|10MB|
|Replacement Strategy|Regex Replacement|
|Evaluation Mode|Line-by-Line|

*Input data:*

{{{"type":"Windows","id":12345},"timestamp":1530539722000,"~event_uuid":"8b4cfd28-5ac6-4ea9-86fc-2c682b76bbc3"}}

*result in 1.5.0:*

{{{"index":\{"_index":"windows-2017.07.02","_type":"windows","_id":"8b4cfd28-5ac6-4ea9-86fc-2c682b76bbc3"}}}}
{{{"type":"Windows","id":12345}}}

*result in 1.7.0:*

{{{"index":\{"_index":"windows-","_type":"","_id":""}}}}
{{{"type":"Windows","id":12345}}}

In 1.7.0, replacement is not working as expected. Only one reference to capture 
group 2 is repalce with the correct content. The other reference to the same 
Group and the references to other groupsĀ are replaced with empty strings. The 
replacement with group 1 in line 2, which does not use expression language, is 
working ok.



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

Reply via email to