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

ASF GitHub Bot commented on NIFI-3837:
--------------------------------------

GitHub user mcgilman opened a pull request:

    https://github.com/apache/nifi/pull/1781

    NIFI-3837: Being more specific with escaping of back references in 
ReplaceText

    NIFI-3837:
    - Being more specific regarding the escaping of back references in 
evaluated expressions.

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/mcgilman/nifi NIFI-3837

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/nifi/pull/1781.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #1781
    
----
commit b5d6158304ee94493f69bc9ce20ce1c53173636b
Author: Matt Gilman <[email protected]>
Date:   2017-05-10T20:15:10Z

    NIFI-3837:
    - Being more specific regarding the escaping of back references in 
evaluated expressions.

----


> ReplaceText - Backreference escape issue in Regex Replace mode when using EL
> ----------------------------------------------------------------------------
>
>                 Key: NIFI-3837
>                 URL: https://issues.apache.org/jira/browse/NIFI-3837
>             Project: Apache NiFi
>          Issue Type: Bug
>          Components: Extensions
>            Reporter: Matt Gilman
>            Assignee: Matt Gilman
>            Priority: Minor
>
> When using ReplaceText in Regex Replace mode, $'s may be incorrectly 
> interrupted as a backreference and escaped. Given input 
> {noformat}'ma$tt'{noformat} and the following ReplaceText configuration:
> {code}
> Search Value - (?s)(^.*$)
> Replacement Value - ${'$1'}
> Character Set - UTF-8
> Maximum Buffer Size - 1 MB
> Replacement Strategy - Regex Replace
> Evaluation Mode - Entire text
> {code}
> The resulting output is {noformat}'ma\$tt'{noformat}
> The issue appears to be that this regular expression is too general [1]. This 
> happens when the replacement string uses expression language. It appears as 
> though all backreferences will be escaped.
> [1] 
> https://github.com/apache/nifi/blob/master/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/ReplaceText.java#L500
>  



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Reply via email to