Support Questions
Find answers, ask questions, and share your expertise
Announcements
Alert: Welcome to the Unified Cloudera Community. Former HCC members be sure to read and learn how to activate your account here.

apache Nifi getFTP regex filter?

Highlighted

apache Nifi getFTP regex filter?

New Contributor

I want to import all files that are from A.

 

I want to import all files with this format [ABC_YYYYMMDD.txt] from FTP.

How should I express [File Filter Regex] field?

 

ex) abc_20200324.txt

1 REPLY 1

Re: apache Nifi getFTP regex filter?

Master Guru

@mary_b 

 

You could use a Java Regular expression like this:

.*_(20)\d\d(0[1-9]|1[012])(0[1-9]|[12][0-9]|3[01]).txt

  The above will match everything before "_" and then must match a number that starts with "20", followed by  to digits "\d\d" (this matches any year in 2001-2099), followed by  "(0[1-9]|1[012])" (this matches months 01-09 or 10,11,12), followed by "(0[1-9]|[12][0-9]|3[01])" (this matches days 01-09 or 10-29 or 30 or 31), ending with the text string ".txt".

 

There are some good regex testers available on the web you may find useful.
https://regexr.com/
http://myregexp.com/
https://www.freeformatter.com/java-regex-tester.html

 

Hope this helps,

Matt

 

Don't have an account?
Coming from Hortonworks? Activate your account here