<?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: How to apply replaceAll to ${path} on NiFi? in Support Questions</title>
    <link>https://community.cloudera.com/t5/Support-Questions/How-to-apply-replaceAll-to-path-on-NiFi/m-p/331898#M231010</link>
    <description>&lt;P&gt;&lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/94191"&gt;@MarcioMarchiori&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Depending on which NiFi Expression Language (NEL) function you are using, either of the following two NEL statements should work for you:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;${path:replaceAll("\\\\",'/')}/${filename}&lt;/LI-CODE&gt;&lt;P&gt;In above you are using the replaceAll function which expects a java regular expression.&amp;nbsp; Since '\" is an escape character and NiFi is a java application, the first \ escapes the second \ and the third \ escapes the forth \.&amp;nbsp; &amp;nbsp;So \\\\ results in a regex of \\ being applied against the value present in the "path" variable.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;or&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;${path:replace('\\','/')}/${filename}&lt;/LI-CODE&gt;&lt;P&gt;In above you are using the replace function which does not path the first argument to be evaluated as a java regular expression but rather takes a string literal.&amp;nbsp; And since '\' is an escape character you need \\ which tells java to treat the second \ as the literal string value to search for.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;If you found this response assisted with your query, please take a moment to login and click on "&lt;STRONG&gt;Accept as Solution&lt;/STRONG&gt;" below this post.&lt;BR /&gt;&lt;BR /&gt;Thank you,&lt;/P&gt;&lt;P&gt;Matt&lt;/P&gt;</description>
    <pubDate>Thu, 09 Dec 2021 19:55:46 GMT</pubDate>
    <dc:creator>MattWho</dc:creator>
    <dc:date>2021-12-09T19:55:46Z</dc:date>
    <item>
      <title>How to apply replaceAll to ${path} on NiFi?</title>
      <link>https://community.cloudera.com/t5/Support-Questions/How-to-apply-replaceAll-to-path-on-NiFi/m-p/331893#M231009</link>
      <description>&lt;P&gt;Hello!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm getting files from a SMB with GetSMBFile, eventually they'll be placed on S3 with PutS3Object, the problem is the path contains "\" on it and I need to replace all of those to "/", I attempted a simple&amp;nbsp;${path:replaceAll('\','//')}/${filename} on the Object Key but it didn't work.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What's the proper way to do this on NiFi?&lt;/P&gt;</description>
      <pubDate>Thu, 09 Dec 2021 17:11:28 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/How-to-apply-replaceAll-to-path-on-NiFi/m-p/331893#M231009</guid>
      <dc:creator>MarcioMarchiori</dc:creator>
      <dc:date>2021-12-09T17:11:28Z</dc:date>
    </item>
    <item>
      <title>Re: How to apply replaceAll to ${path} on NiFi?</title>
      <link>https://community.cloudera.com/t5/Support-Questions/How-to-apply-replaceAll-to-path-on-NiFi/m-p/331898#M231010</link>
      <description>&lt;P&gt;&lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/94191"&gt;@MarcioMarchiori&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Depending on which NiFi Expression Language (NEL) function you are using, either of the following two NEL statements should work for you:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;${path:replaceAll("\\\\",'/')}/${filename}&lt;/LI-CODE&gt;&lt;P&gt;In above you are using the replaceAll function which expects a java regular expression.&amp;nbsp; Since '\" is an escape character and NiFi is a java application, the first \ escapes the second \ and the third \ escapes the forth \.&amp;nbsp; &amp;nbsp;So \\\\ results in a regex of \\ being applied against the value present in the "path" variable.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;or&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;${path:replace('\\','/')}/${filename}&lt;/LI-CODE&gt;&lt;P&gt;In above you are using the replace function which does not path the first argument to be evaluated as a java regular expression but rather takes a string literal.&amp;nbsp; And since '\' is an escape character you need \\ which tells java to treat the second \ as the literal string value to search for.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;If you found this response assisted with your query, please take a moment to login and click on "&lt;STRONG&gt;Accept as Solution&lt;/STRONG&gt;" below this post.&lt;BR /&gt;&lt;BR /&gt;Thank you,&lt;/P&gt;&lt;P&gt;Matt&lt;/P&gt;</description>
      <pubDate>Thu, 09 Dec 2021 19:55:46 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/How-to-apply-replaceAll-to-path-on-NiFi/m-p/331898#M231010</guid>
      <dc:creator>MattWho</dc:creator>
      <dc:date>2021-12-09T19:55:46Z</dc:date>
    </item>
    <item>
      <title>Re: How to apply replaceAll to ${path} on NiFi?</title>
      <link>https://community.cloudera.com/t5/Support-Questions/How-to-apply-replaceAll-to-path-on-NiFi/m-p/331903#M231014</link>
      <description>&lt;P&gt;Thanks mate, I had completely forgotten about the need for the need for the '\\\\', that solved it.&lt;/P&gt;</description>
      <pubDate>Fri, 10 Dec 2021 03:00:28 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/How-to-apply-replaceAll-to-path-on-NiFi/m-p/331903#M231014</guid>
      <dc:creator>MarcioMarchiori</dc:creator>
      <dc:date>2021-12-10T03:00:28Z</dc:date>
    </item>
  </channel>
</rss>

