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

Sebastian Schlitte commented on NIFI-5369:
------------------------------------------

Hi Otto, 

thank you very much for looking into this. The regex you state in your last 
post is exactly what we want to match. If it was not displayed like that, it 
must have been the formatting.

I can confirm that what you suggested as  "Replace Value" works fine! 
Apparently, my original statement uses expression language where it is not 
required. We will now use that simplified version.

> 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
>            Assignee: Otto Fowler
>            Priority: Major
>
> ||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