[jira] [Commented] (NIFI-5369) ReplaceText not replacing all references to capture groups

2018-07-04 Thread Sebastian Schlitte (JIRA)


[ 
https://issues.apache.org/jira/browse/NIFI-5369?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=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('.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)


[jira] [Commented] (NIFI-5369) ReplaceText not replacing all references to capture groups

2018-07-03 Thread Otto Fowler (JIRA)


[ 
https://issues.apache.org/jira/browse/NIFI-5369?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=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('.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('.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)


[jira] [Commented] (NIFI-5369) ReplaceText not replacing all references to capture groups

2018-07-03 Thread Otto Fowler (JIRA)


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

Otto Fowler commented on NIFI-5369:
---

I think the formatting here may be messing me up.

Can you post a template?

> 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('.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)


[jira] [Commented] (NIFI-5369) ReplaceText not replacing all references to capture groups

2018-07-03 Thread Otto Fowler (JIRA)


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

Otto Fowler commented on NIFI-5369:
---

I'll take a look at this

> 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('.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)