Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

tFTPGet, Filemask and Regex question.

Hello,
I?m trying to use Regex expression in Filemask of tFTPGet component.
I've never used regex before? So i use this site as a reference: http://www.regular-expressions.info/reference.html
How exactly regex expression should looks like if I want to get only files ending with _yyyyMMdd.csv
I tried to use the following expression but without success: ".*_.*\.csv"
Labels (2)
4 Replies
Anonymous
Not applicable
Author

Hi,
For the purpose of unprofessional user, the file mask of tFTPXXX components is not according to the regex principle.
Try: "*_*.csv".
regard.
Anonymous
Not applicable
Author

Thanks for your answer nsun.
But if it?s not regex why the following regex style mask works fine - "bo(o|u)t" ?
By the way when I use ?windows style? mask *_??????.csv the following error appeals to java regex package java.util.regex.PatternSyntaxException.
Exception in component tFTPGet_1
java.util.regex.PatternSyntaxException: Dangling meta character '?' near index 5
.*_??????\.csv
^
What is correct syntax for Filemask in tFTPGet ?!
Anonymous
Not applicable
Author

==>But if it?s not regex why the following regex style mask works fine - "bo(o|u)t" ?
Because it actually use java.util.regex to handle matches in the bottom code, but before that , it do some transform, as a matter of fact: replace all "." with "\.") and replace all "*" with ".*".
==>By the way when I use ?windows style? mask *_??????.csv the following error appeals to java regex package java.util.regex.PatternSyntaxException.
I don't know the code writer's original intention, I guess it just in order to suit the behavior of common user who have no idea what Regex is, and it's not a completely implement of ?windows style? mask for sure. "*" is just easier to understand than ".*".
==>Exception in component tFTPGet_1
java.util.regex.PatternSyntaxException: Dangling meta character '?' near index 5
.*_??????\.csv
^
Above-mentioned, "??????" is kind of ?windows style? it doesn't support.
It indeed break the regex rule, so if needed we consider adding a feature of regex option for advanced settings.
Anonymous
Not applicable
Author

Thanks for your explanations nsun.
The following mask did a trick for my initial problem: ?*_{6}.csv?
You can use pretty much of regex in the filemask? just take in account that Taled replace ?.? with ?\.? and ?*? with ?.*?
I?m on TOS 3.2.0.M1 right now.