<?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 Re: Using regular expression on flowfilename to update Attribute in Support Questions</title>
    <link>https://community.cloudera.com/t5/Support-Questions/Using-regular-expression-on-flowfilename-to-update-Attribute/m-p/218867#M180768</link>
    <description>&lt;P&gt;&lt;A rel="user" href="https://community.cloudera.com/users/16412/simonjespersen.html" nodeid="16412" target="_blank"&gt;@Simon Jespersen&lt;/A&gt;
&lt;/P&gt;&lt;P&gt;Can you once try using the below methods to &lt;STRONG&gt;change the filename&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;1.by using &lt;STRONG&gt;replaceAll&lt;/STRONG&gt; string manupulation and adding the filename property as&lt;/P&gt;&lt;PRE&gt;${filename:replaceAll('.*\_([A-Za-z]{3,5})\_([0-9]{8}).*xxxxxxx.json','$2')}.json&lt;/PRE&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="40817-replaceall.png" style="width: 821px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/16033i23C822B06597256F/image-size/medium?v=v2&amp;amp;px=400" role="button" title="40817-replaceall.png" alt="40817-replaceall.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;2.another way is using &lt;STRONG&gt;getdelimited Manupulation&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;by adding&lt;STRONG&gt; filename&lt;/STRONG&gt; property as&lt;/P&gt;&lt;PRE&gt;${filename:getDelimitedField(3, '_'):substring(0,8)}.json&lt;/PRE&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="40814-getdelimited.png" style="width: 707px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/16034i8DC5B496774476C9/image-size/medium?v=v2&amp;amp;px=400" role="button" title="40814-getdelimited.png" alt="40814-getdelimited.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Both ways results the same output you can choose the best way which will fits for your case.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;U&gt;Output:-&lt;/U&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="40816-fn.png" style="width: 275px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/16035i7C7858A5DF8B6020/image-size/medium?v=v2&amp;amp;px=400" role="button" title="40816-fn.png" alt="40816-fn.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Sun, 18 Aug 2019 02:45:33 GMT</pubDate>
    <dc:creator>Shu_ashu</dc:creator>
    <dc:date>2019-08-18T02:45:33Z</dc:date>
    <item>
      <title>Using regular expression on flowfilename to update Attribute</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Using-regular-expression-on-flowfilename-to-update-Attribute/m-p/218866#M180767</link>
      <description>&lt;P&gt;Hello, &lt;/P&gt;&lt;P&gt;I am ingesting files with  &lt;/P&gt;&lt;P&gt;names like &lt;/P&gt;&lt;P&gt;I_XXX_20171002024210_LU2016DKABCDE12345-2017-10-02-TESTDAC2-000003_xxxxxxx.json&lt;/P&gt;&lt;P&gt;I_SSSSS_20171003024653_US2016US3661159602CC8FC7-4963-4304-A211-D8BCDA152625_xxxxxxx.json&lt;/P&gt;&lt;P&gt;I want to update/set a flowfile attribute using regular expression on the filename &lt;/P&gt;&lt;P&gt;Is there a nifi expression language function that support that.&lt;/P&gt;&lt;P&gt;ie. ${filename:&amp;lt;regexec:()&amp;gt;}&lt;/P&gt;&lt;P&gt;This regular expression extract the date yyyymmdd in capture group #2  from the filename&lt;/P&gt;&lt;PRE&gt;\_([A-Za-z]{3,5})\_([0-9]{8}).*xxxxxxx.json&lt;/PRE&gt;</description>
      <pubDate>Thu, 12 Oct 2017 19:33:37 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Using-regular-expression-on-flowfilename-to-update-Attribute/m-p/218866#M180767</guid>
      <dc:creator>simon_jespersen</dc:creator>
      <dc:date>2017-10-12T19:33:37Z</dc:date>
    </item>
    <item>
      <title>Re: Using regular expression on flowfilename to update Attribute</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Using-regular-expression-on-flowfilename-to-update-Attribute/m-p/218867#M180768</link>
      <description>&lt;P&gt;&lt;A rel="user" href="https://community.cloudera.com/users/16412/simonjespersen.html" nodeid="16412" target="_blank"&gt;@Simon Jespersen&lt;/A&gt;
&lt;/P&gt;&lt;P&gt;Can you once try using the below methods to &lt;STRONG&gt;change the filename&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;1.by using &lt;STRONG&gt;replaceAll&lt;/STRONG&gt; string manupulation and adding the filename property as&lt;/P&gt;&lt;PRE&gt;${filename:replaceAll('.*\_([A-Za-z]{3,5})\_([0-9]{8}).*xxxxxxx.json','$2')}.json&lt;/PRE&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="40817-replaceall.png" style="width: 821px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/16033i23C822B06597256F/image-size/medium?v=v2&amp;amp;px=400" role="button" title="40817-replaceall.png" alt="40817-replaceall.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;2.another way is using &lt;STRONG&gt;getdelimited Manupulation&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;by adding&lt;STRONG&gt; filename&lt;/STRONG&gt; property as&lt;/P&gt;&lt;PRE&gt;${filename:getDelimitedField(3, '_'):substring(0,8)}.json&lt;/PRE&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="40814-getdelimited.png" style="width: 707px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/16034i8DC5B496774476C9/image-size/medium?v=v2&amp;amp;px=400" role="button" title="40814-getdelimited.png" alt="40814-getdelimited.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Both ways results the same output you can choose the best way which will fits for your case.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;U&gt;Output:-&lt;/U&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="40816-fn.png" style="width: 275px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/16035i7C7858A5DF8B6020/image-size/medium?v=v2&amp;amp;px=400" role="button" title="40816-fn.png" alt="40816-fn.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 18 Aug 2019 02:45:33 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Using-regular-expression-on-flowfilename-to-update-Attribute/m-p/218867#M180768</guid>
      <dc:creator>Shu_ashu</dc:creator>
      <dc:date>2019-08-18T02:45:33Z</dc:date>
    </item>
    <item>
      <title>Re: Using regular expression on flowfilename to update Attribute</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Using-regular-expression-on-flowfilename-to-update-Attribute/m-p/218868#M180769</link>
      <description>&lt;P&gt;&lt;A rel="user" href="https://community.cloudera.com/users/18929/yaswanthmuppireddy.html" nodeid="18929"&gt;@Shu&lt;/A&gt; Thank you so very much for that really good answer.  &lt;/P&gt;</description>
      <pubDate>Thu, 12 Oct 2017 20:11:38 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Using-regular-expression-on-flowfilename-to-update-Attribute/m-p/218868#M180769</guid>
      <dc:creator>simon_jespersen</dc:creator>
      <dc:date>2017-10-12T20:11:38Z</dc:date>
    </item>
    <item>
      <title>Re: Using regular expression on flowfilename to update Attribute</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Using-regular-expression-on-flowfilename-to-update-Attribute/m-p/218869#M180770</link>
      <description>&lt;P&gt;&lt;A href="https://community.hortonworks.com/users/16412/simonjespersen.html" rel="nofollow noopener noreferrer" target="_blank"&gt;@Simon Jespersen&lt;/A&gt;&lt;/P&gt;&lt;P&gt;You can use UpdateAttribute and create a new attribute with the following EL : ${filename:getDelimitedField(3,'_')}&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="40818-screen-shot-2017-10-12-at-31354-pm.png" style="width: 1010px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/16032i02B9F42B1A8FC65C/image-size/medium?v=v2&amp;amp;px=400" role="button" title="40818-screen-shot-2017-10-12-at-31354-pm.png" alt="40818-screen-shot-2017-10-12-at-31354-pm.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 18 Aug 2019 02:45:14 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Using-regular-expression-on-flowfilename-to-update-Attribute/m-p/218869#M180770</guid>
      <dc:creator>ahadjidj</dc:creator>
      <dc:date>2019-08-18T02:45:14Z</dc:date>
    </item>
  </channel>
</rss>

