<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>question Why is there an error on the colon in ${attribute:find...? in Support Questions</title>
    <link>https://community.cloudera.com/t5/Support-Questions/Why-is-there-an-error-on-the-colon-in-attribute-find/m-p/373171#M241509</link>
    <description>&lt;P&gt;I want to use &lt;A href="https://nifi.apache.org/docs/nifi-docs/components/org.apache.nifi/nifi-standard-nar/1.11.4/org.apache.nifi.processors.standard.RouteOnAttribute/index.html" target="_self"&gt;RouteOnAttribute&lt;/A&gt; to filter on a regex. To do so, I added two attributes in the Properties:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;TABLE border="1" width="100%"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD width="50%"&gt;Property&lt;/TD&gt;&lt;TD width="50%"&gt;Value&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="50%"&gt;private&lt;/TD&gt;&lt;TD width="50%"&gt;${ip:find('^(10|127|169\.254|172\.1[6-9]|172\.2[0-9]|172\.3[0-1]|192\.168)\.')}&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="50%"&gt;public&lt;/TD&gt;&lt;TD width="50%"&gt;${ip:find('^([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])(?&amp;lt;!172\.(16|17|18|19|20|21|22|23|24|25|26|27|28|29|30|31))(?&amp;lt;!127)(?&amp;lt;!^10)(?&amp;lt;!^0)\.([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])(?&amp;lt;!192\.168)(?&amp;lt;!172\.(16|17|18|19|20|21|22|23|24|25|26|27|28|29|30|31))\.([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$')}&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This processor shows two errors, both the same: `Unexpected token ':' at line 1 column 4`&lt;/P&gt;&lt;P&gt;Why is this an error?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 23 Jun 2023 18:19:19 GMT</pubDate>
    <dc:creator>Wpq</dc:creator>
    <dc:date>2023-06-23T18:19:19Z</dc:date>
    <item>
      <title>Why is there an error on the colon in ${attribute:find...?</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Why-is-there-an-error-on-the-colon-in-attribute-find/m-p/373171#M241509</link>
      <description>&lt;P&gt;I want to use &lt;A href="https://nifi.apache.org/docs/nifi-docs/components/org.apache.nifi/nifi-standard-nar/1.11.4/org.apache.nifi.processors.standard.RouteOnAttribute/index.html" target="_self"&gt;RouteOnAttribute&lt;/A&gt; to filter on a regex. To do so, I added two attributes in the Properties:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;TABLE border="1" width="100%"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD width="50%"&gt;Property&lt;/TD&gt;&lt;TD width="50%"&gt;Value&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="50%"&gt;private&lt;/TD&gt;&lt;TD width="50%"&gt;${ip:find('^(10|127|169\.254|172\.1[6-9]|172\.2[0-9]|172\.3[0-1]|192\.168)\.')}&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="50%"&gt;public&lt;/TD&gt;&lt;TD width="50%"&gt;${ip:find('^([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])(?&amp;lt;!172\.(16|17|18|19|20|21|22|23|24|25|26|27|28|29|30|31))(?&amp;lt;!127)(?&amp;lt;!^10)(?&amp;lt;!^0)\.([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])(?&amp;lt;!192\.168)(?&amp;lt;!172\.(16|17|18|19|20|21|22|23|24|25|26|27|28|29|30|31))\.([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$')}&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This processor shows two errors, both the same: `Unexpected token ':' at line 1 column 4`&lt;/P&gt;&lt;P&gt;Why is this an error?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 23 Jun 2023 18:19:19 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Why-is-there-an-error-on-the-colon-in-attribute-find/m-p/373171#M241509</guid>
      <dc:creator>Wpq</dc:creator>
      <dc:date>2023-06-23T18:19:19Z</dc:date>
    </item>
    <item>
      <title>Re: Why is there an error on the colon in ${attribute:find...?</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Why-is-there-an-error-on-the-colon-in-attribute-find/m-p/373184#M241515</link>
      <description>&lt;P&gt;You probably need to escape the $ which is a special character in NiFi...try adding \ or \\&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="joseomjr_0-1687655182513.png" style="width: 400px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/37914iE5640D0EE2FD6FBA/image-size/medium?v=v2&amp;amp;px=400" role="button" title="joseomjr_0-1687655182513.png" alt="joseomjr_0-1687655182513.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 25 Jun 2023 01:06:30 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Why-is-there-an-error-on-the-colon-in-attribute-find/m-p/373184#M241515</guid>
      <dc:creator>joseomjr</dc:creator>
      <dc:date>2023-06-25T01:06:30Z</dc:date>
    </item>
    <item>
      <title>Re: Why is there an error on the colon in ${attribute:find...?</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Why-is-there-an-error-on-the-colon-in-attribute-find/m-p/373201#M241526</link>
      <description>&lt;P&gt;&lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/105689"&gt;@Wpq&lt;/a&gt;,&lt;BR /&gt;&lt;BR /&gt;I do not think that NiFi supports the full syntax of Java regular expressions directly, like you are trying to do, especially on attributes and using NiFi's Expression Language.&lt;BR /&gt;What I would recommend you to try is to use NiFi's EL to replace that entire regex, something like:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;${ip:startsWith('10.') or ip:startsWith('127.') or ip:startsWith('169.254.') or (ip:startsWith('172.') and ip:substring(4, 6):matches('1[6-9]|2[0-9]|3[0-1]')) or ip:startsWith('192.168.')}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The above code is not 100% correct, I am more than certain, but you can extrapolate from that example and rewrite your query somehow like that. The NiFi EL functions you should use are:&lt;BR /&gt;&lt;STRONG&gt;OR:&lt;/STRONG&gt;&lt;BR /&gt;${ fileSize:lt(64):&lt;STRONG&gt;or&lt;/STRONG&gt;( ${fileSize:gt(128)} )}&lt;BR /&gt;&lt;STRONG&gt;StartsWith:&lt;/STRONG&gt;&lt;BR /&gt;${ filename:&lt;STRONG&gt;startsWith&lt;/STRONG&gt;('fizz') }&lt;BR /&gt;&lt;STRONG&gt;Matches:&lt;/STRONG&gt;&lt;BR /&gt;${ filename:&lt;STRONG&gt;matches&lt;/STRONG&gt;('fizz.*txt') }&lt;BR /&gt;&lt;STRONG&gt;And:&lt;/STRONG&gt;&lt;BR /&gt;${ fileSize:gt(64):&lt;STRONG&gt;and&lt;/STRONG&gt;( ${fileSize:lt(128)} )}&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 26 Jun 2023 06:53:52 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Why-is-there-an-error-on-the-colon-in-attribute-find/m-p/373201#M241526</guid>
      <dc:creator>cotopaul</dc:creator>
      <dc:date>2023-06-26T06:53:52Z</dc:date>
    </item>
    <item>
      <title>Re: Why is there an error on the colon in ${attribute:find...?</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Why-is-there-an-error-on-the-colon-in-attribute-find/m-p/373236#M241531</link>
      <description>&lt;P&gt;The issue ended up being that &lt;A href="https://nifi.apache.org/docs/nifi-docs/html/expression-language-guide.html#ip" target="_self"&gt;ip&lt;/A&gt; is a reserved word (a default function) so changing the name of the attribute from ip to extractedIp solved it.&lt;/P&gt;</description>
      <pubDate>Mon, 26 Jun 2023 10:37:37 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Why-is-there-an-error-on-the-colon-in-attribute-find/m-p/373236#M241531</guid>
      <dc:creator>Wpq</dc:creator>
      <dc:date>2023-06-26T10:37:37Z</dc:date>
    </item>
  </channel>
</rss>

