Closed giswqs closed 3 years ago
For now it's based on fnmatch.fnmatch
which has a limited matching capability. I'll put true regex support on the todo list.
That would be awesome! Many thanks.
@giswqs question as I start to add this. I don't want to break the current implementation with fnmatch
so I want to double check if you require any additional use cases beyond multiple file extensions or fnmatch
patterns?
Adding regex support without breaking the current implementation would mean adding a new parameter, but if it's just a matter of supporting multiple fnmatch
patterns, I can easily extend the current implementation of a single string by also allowing for a list of fnmatch
patterns, like ['*.png', '*.gif', '*.jpg']
.
Allowing a list of fnmatch
patterns should be sufficient. Thanks.
My user case is to allow users to select files with specific file extensions to perform geospatial analysis. At the moment, I could not specify the file pattern if I want to allow multiple file extensions.
https://github.com/giswqs/whiteboxgui
https://user-images.githubusercontent.com/5016453/105920916-2f072600-6006-11eb-92e4-033f949701ba.mp4
Thanks for the quick response!
@giswqs apologies for the delay on this. Version 0.4.2 (https://github.com/crahan/ipyfilechooser/releases/tag/v0.4.2) has now been pushed to PyPi and conda-forge. You can still specify a single fnmatch
string, but the filter_pattern
parameter now also supports a list of multiple fnmatch
strings.
Fantastic! Will test it shortly. Thanks a lot for your efforts!
Is it possible to filter files by multiple file extensions (e.g., .png, .jpg)? It seems
fc.filter_pattern
can only support one file extension.