Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How can i filter files with specific multi extensions #94

Open
joshmpaka opened this issue Aug 27, 2021 · 2 comments
Open

How can i filter files with specific multi extensions #94

joshmpaka opened this issue Aug 27, 2021 · 2 comments

Comments

@joshmpaka
Copy link

joshmpaka commented Aug 27, 2021

I am trying to filter files with multiple extensions like filename.info.mp3.
I have tried extensions: /\.(info|mp3)$/ but this just brings all files that have one or both of those extensions but I only want to filter files with both extensions, not just one of the extensions.
I also tried extensions: /\.info.mp3/ but got an error
Your help would be greatly appreciated

@mihneadb
Copy link
Owner

mihneadb commented Sep 1, 2021

This is a tricky one and is caused (if we are to call it that) by Path.extname. It always returns the extension as starting from the last occurrence of .. It kind of makes sense, if you had a file.like.this.info.mp3, which would be the extension?

I guess for our specific need we could change the logic to "filename ends with ext" instead of the current way of doing it. But then you may get into other issues.

Probably the simplest thing is to replace the idea of "extension" filtering with something like regex name filtering. Thoughts?

@joshmpaka
Copy link
Author

Regex name filtering definitely does seem more viable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants