You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@nifi.apache.org by Milan Das <md...@interset.com> on 2018/06/13 12:47:36 UTC

NIFI regex expression on RouteOnAttribute

Hello All,

I am trying to use “RouteOnAttribute” on the following text attribute “/tmp/subdir/9/” with the expression   ${setabsolutepath:matches('\\/9|12\\/')} 

I also tried without escape sequence ${setabsolutepath:matches('\/9|12\/')} 

Everytime it is getting routed to unmatched.

 

Here is my regex

https://regex101.com/r/kINhh9/1

 

 

Can somebody help me if there is a silly mistake or some problem with the NIFI code?

 

Regards,

Milan


Re: NIFI regex expression on RouteOnAttribute

Posted by Mark Payne <ma...@hotmail.com>.
Milan,

Your regex, I think, is fine, but you're using the "matches" function, which requires that the entire
value match the regex exactly. It appears that you're trying to check if the value contains the regex
anywhere within it, so you'd want to use the "find" function instead:

${setabsolutepath:find('\/V9|12V')}

Thanks
-Mark


> On Jun 13, 2018, at 8:47 AM, Milan Das <md...@interset.com> wrote:
> 
> Hello All,
> 
> I am trying to use “RouteOnAttribute” on the following text attribute “/tmp/subdir/9/” with the expression   ${setabsolutepath:matches('\\/9|12\\/')} 
> 
> I also tried without escape sequence ${setabsolutepath:matches('\/9|12\/')} 
> 
> Everytime it is getting routed to unmatched.
> 
> 
> 
> Here is my regex
> 
> https://regex101.com/r/kINhh9/1
> 
> 
> 
> 
> 
> Can somebody help me if there is a silly mistake or some problem with the NIFI code?
> 
> 
> 
> Regards,
> 
> Milan
>