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

Announcements
Save an extra $150 Dec 1–7 with code CYBERWEEK - stackable with early bird savings: Register
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

How to find files that the filenames start with 3 digits?

I have many files in a folder and the filenames fall into different patterns:

123 store_location1.xlsm

234 store_location2.xlsm

235 store_location3.xlsm

....

1 - Grocery.xlsm

2 - Dairy.xlsm

...

Division 1 - Grocery.xlsm

Division 2 - Grocery.xlsm

...

 

How can I get only these files that the names start with 3 digits?

Please help!

 

 

 

Labels (2)
1 Solution

Accepted Solutions
Jesperrekuh
Specialist
Specialist

tFileList use regex expression to filter...
"^[0-9]{3}.+xlsm$"

Take a closer look at (java) regex in general, this will open up pandoras box regarding string matching searching and even replacing... pretty awesome.
http://www.regexplanet.com/advanced/java/index.html

View solution in original post

5 Replies
Jesperrekuh
Specialist
Specialist

tFileList use regex expression to filter...
"^[0-9]{3}.+xlsm$"

Take a closer look at (java) regex in general, this will open up pandoras box regarding string matching searching and even replacing... pretty awesome.
http://www.regexplanet.com/advanced/java/index.html
Anonymous
Not applicable
Author

Thank you Dijke very much for your quick response!

 

If I want to filter the ones that filenames start with 3 digits, and the extension could either be .xlsm or .xls, 

should the modified regex expression to be:

"^[0-9]{3}.+xls$"
?

Could you please give a quick explanation about how this expression works?

Thanks!

 

TM

Anonymous
Not applicable
Author

add a question mark ? after the m to optionally match the m

^[0-9]{3}.+xlsm?$

 

^ match start of line
[0-9]{3} match 3 numbers that range from 0-9
.+ match any character one or more times
xlsm? match the letters "xls" and optionally "m"
$ match end of line
Anonymous
Not applicable
Author

Can anyone recommend a site for people like me to learn Regex Expression step by step?

Jesperrekuh
Specialist
Specialist

here you go :
http://www.vogella.com/tutorials/JavaRegularExpressions/article.html
This link a little more related to java coding:
https://regexone.com/references/java

This site is to test and experiment/validate your expressions: http://www.regexplanet.com/advanced/java/index.html