You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@nifi.apache.org by Madhukar Thota <ma...@gmail.com> on 2016/04/27 21:44:56 UTC

Nifi parsing examples

Friends,

I am looking for attributes parsing examples. Any help is appreciated?

I want to get  difference between two feilds attributes

1. let say  end - start:

${end:minus(${start}) is this right way to do it?
2. I want to mask password in the url, how can i do it?

example: http://username:pwd@host.com to http://username:xxxxx@host.com

3. How to parse url encoded post data?

Today i am doing all the conversation using ExecuteScriptProcessor using
python but it is very slow in processing.

Any help is appreciated.

-Madhu

Re: Nifi parsing examples

Posted by Matt Burgess <ma...@gmail.com>.
Sorry that was just for example #2 :)


> On Apr 27, 2016, at 3:59 PM, Matt Burgess <ma...@gmail.com> wrote:
> 
> If you can represent the expected string format as a regular
> expression, you can use the replaceAll() function [1] with
> back-references:
> 
> ${url:replaceAll('(http://[a-zA-Z0-9]+:)[a-zA-Z0-9]+(@.*)','$1xxxxx$2')}
> 
> original: http://username:pwd@host.com
> after: http://username:xxxxx@host.com
> 
> Note I have parentheses around the groups I want to keep (the
> beginning and end, everything but the password part), then I can
> re-insert them using back-references $1 and $2 (i.e. the capturing
> groups)
> 
> [1] https://nifi.apache.org/docs/nifi-docs/html/expression-language-guide.html#replaceall
> 
> Regards,
> Matt
> 
> On Wed, Apr 27, 2016 at 3:44 PM, Madhukar Thota
> <ma...@gmail.com> wrote:
>> Friends,
>> 
>> I am looking for attributes parsing examples. Any help is appreciated?
>> 
>> I want to get  difference between two feilds attributes
>> 
>> 1. let say  end - start:
>> 
>> ${end:minus(${start}) is this right way to do it?
>> 2. I want to mask password in the url, how can i do it?
>> 
>> example: http://username:pwd@host.com to http://username:xxxxx@host.com
>> 
>> 3. How to parse url encoded post data?
>> 
>> Today i am doing all the conversation using ExecuteScriptProcessor using
>> python but it is very slow in processing.
>> 
>> Any help is appreciated.
>> 
>> -Madhu

Re: Nifi parsing examples

Posted by Matt Burgess <ma...@gmail.com>.
If you can represent the expected string format as a regular
expression, you can use the replaceAll() function [1] with
back-references:

${url:replaceAll('(http://[a-zA-Z0-9]+:)[a-zA-Z0-9]+(@.*)','$1xxxxx$2')}

original: http://username:pwd@host.com
after: http://username:xxxxx@host.com

Note I have parentheses around the groups I want to keep (the
beginning and end, everything but the password part), then I can
re-insert them using back-references $1 and $2 (i.e. the capturing
groups)

[1] https://nifi.apache.org/docs/nifi-docs/html/expression-language-guide.html#replaceall

Regards,
Matt

On Wed, Apr 27, 2016 at 3:44 PM, Madhukar Thota
<ma...@gmail.com> wrote:
> Friends,
>
> I am looking for attributes parsing examples. Any help is appreciated?
>
> I want to get  difference between two feilds attributes
>
> 1. let say  end - start:
>
> ${end:minus(${start}) is this right way to do it?
> 2. I want to mask password in the url, how can i do it?
>
> example: http://username:pwd@host.com to http://username:xxxxx@host.com
>
> 3. How to parse url encoded post data?
>
> Today i am doing all the conversation using ExecuteScriptProcessor using
> python but it is very slow in processing.
>
> Any help is appreciated.
>
> -Madhu