[
https://issues.apache.org/jira/browse/NIFI-5369?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16531730#comment-16531730
]
Otto Fowler commented on NIFI-5369:
-----------------------------------
In 1.7.0 there was a change in order to fix a bug NIFI-4272. As a result of
this, the EL is evaluated after the regex.
I was able to get your scenario ( basically ) working with the following regex
and replacement ( note I had to change the regex to work, I am not sure if that
was the formatting or not ).
{code:java}
Search Value :
(^."type":"([0-9A-Za-z\-]+).*\}),"timestamp":\s?([0-9]+),"~event_uuid":\s?\"([0-9A-Za-z-.]+).*$
Replace Value :
{"index":{"_index":$2-${'$3':format('yyyy.MM.dd')}","_type":"$2","_id":"$4"}"}}$1
{code}
> 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)