Re: Nifi parsing examples

2016-04-27 Thread Matt Burgess
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]+(@.*)','$1x$2')}

original: http://username:p...@host.com
after: http://username:xx...@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
 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:p...@host.com to http://username:xx...@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

2016-04-27 Thread Matt Burgess
Sorry that was just for example #2 :)


> On Apr 27, 2016, at 3:59 PM, Matt Burgess  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]+(@.*)','$1x$2')}
> 
> original: http://username:p...@host.com
> after: http://username:xx...@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
>  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:p...@host.com to http://username:xx...@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