You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@nifi.apache.org by Asanka Sanjaya Herath <an...@gmail.com> on 2016/09/30 11:57:01 UTC

ReplaceText processor - $ symbol escaping done incorrectly

Hi,

I'm using Replace text processor[1] to build a json in my flow file.

Flow file has following attribute:


*messageId: 001201d20dd3$7bcdc870$73695950$@xx.yy.co <http://xx.yy.co>*

Replace text processor "Replacement Value":

*{*
*"messageId" : "${messageId}"*
*}*

And all other properties are set to default values.

So that I'm expecting the flow file content output to be this:

*{*
*"messageId" : "001201d20dd3$7bcdc870$73695950$@xx.yy.co <http://xx.yy.co>"*
*}*

​But it actually is:
*{*
* "messageId" : "001201d20dd3\$7bcdc870\$73695950\$@integramicro.co.in
<http://integramicro.co.in>"*
*}*
​
All $ characters are combined with a \ character. Can someone help me to
get rid of these slashes? Any help would be highly appreciated.

​[1].
https://github.com/apache/nifi/blob/rel/nifi-1.0.0/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/ReplaceText.java
​

​​

-- 
Thanks,
Regards,
ASH

Re: ReplaceText processor - $ symbol escaping done incorrectly

Posted by Asanka Sanjaya Herath <an...@gmail.com>.
@james, Yes that was the problem. I changed "Regex Replace" to "Always
Replace" and it worked fine. Thanks so much for the help.

On Sat, Oct 1, 2016 at 12:27 AM, James Wing <jv...@gmail.com> wrote:

> In your ReplaceText processor, is the Replacement Strategy property set to
> the default "Regex Replace"?  You might try "Always Replace" or changing
> the Search Value to ".*" (without quotes).  I suspect it is escaping your $
> as part of processing the regex.
>
>
> Thanks,
>
> James
>
> On Fri, Sep 30, 2016 at 4:57 AM, Asanka Sanjaya Herath <angal.sh@gmail.com
> > wrote:
>
>> Hi,
>>
>> I'm using Replace text processor[1] to build a json in my flow file.
>>
>> Flow file has following attribute:
>>
>>
>> *messageId: 001201d20dd3$7bcdc870$73695950$@xx.yy.co <http://xx.yy.co>*
>>
>> Replace text processor "Replacement Value":
>>
>> *{*
>> *"messageId" : "${messageId}"*
>> *}*
>>
>> And all other properties are set to default values.
>>
>> So that I'm expecting the flow file content output to be this:
>>
>> *{*
>> *"messageId" : "001201d20dd3$7bcdc870$73695950$@xx.yy.co
>> <http://xx.yy.co>"*
>> *}*
>>
>> ​But it actually is:
>> *{*
>> * "messageId" : "001201d20dd3\$7bcdc870\$73695950\$@integramicro.co.in
>> <http://integramicro.co.in>"*
>> *}*
>> ​
>> All $ characters are combined with a \ character. Can someone help me to
>> get rid of these slashes? Any help would be highly appreciated.
>>
>> ​[1]. https://github.com/apache/nifi/blob/rel/nifi-1.0.0/nifi-nar-
>> bundles/nifi-standard-bundle/nifi-standard-processors/src/
>> main/java/org/apache/nifi/processors/standard/ReplaceText.java​
>>
>> ​​
>>
>> --
>> Thanks,
>> Regards,
>> ASH
>>
>
>


-- 
Thanks,
Regards,
ASH

Re: ReplaceText processor - $ symbol escaping done incorrectly

Posted by James Wing <jv...@gmail.com>.
In your ReplaceText processor, is the Replacement Strategy property set to
the default "Regex Replace"?  You might try "Always Replace" or changing
the Search Value to ".*" (without quotes).  I suspect it is escaping your $
as part of processing the regex.


Thanks,

James

On Fri, Sep 30, 2016 at 4:57 AM, Asanka Sanjaya Herath <an...@gmail.com>
wrote:

> Hi,
>
> I'm using Replace text processor[1] to build a json in my flow file.
>
> Flow file has following attribute:
>
>
> *messageId: 001201d20dd3$7bcdc870$73695950$@xx.yy.co <http://xx.yy.co>*
>
> Replace text processor "Replacement Value":
>
> *{*
> *"messageId" : "${messageId}"*
> *}*
>
> And all other properties are set to default values.
>
> So that I'm expecting the flow file content output to be this:
>
> *{*
> *"messageId" : "001201d20dd3$7bcdc870$73695950$@xx.yy.co
> <http://xx.yy.co>"*
> *}*
>
> ​But it actually is:
> *{*
> * "messageId" : "001201d20dd3\$7bcdc870\$73695950\$@integramicro.co.in
> <http://integramicro.co.in>"*
> *}*
> ​
> All $ characters are combined with a \ character. Can someone help me to
> get rid of these slashes? Any help would be highly appreciated.
>
> ​[1]. https://github.com/apache/nifi/blob/rel/nifi-1.0.0/nifi-
> nar-bundles/nifi-standard-bundle/nifi-standard-
> processors/src/main/java/org/apache/nifi/processors/
> standard/ReplaceText.java​
>
> ​​
>
> --
> Thanks,
> Regards,
> ASH
>