File wildcard*
-
I thought this was working before, but it might be me...
I'm trying to find files like
"MyFilexxx.txt"
using"MyFile*.txt"
wildcard to get start+end of the file but it doesn't work...
Normal behaviour or mistake is mine? -
@ustk I struggled with this too. The regex seemed busted last time I tried.
-
@ustk Mistake is yours. You need to remove the .txt after the * and filter for that separately in a loop. Or perhaps use regex.
-
@Casey-Kolb @d-healey thanks! It's for a
FileSystem.browse
so I'm not sure a loop is possible.
Thought I could spend the rest of my life far from regex, perhaps a pint in my hand, rockin' back n forth, but things are what they are… :) -
@ustk You might find this helpful - https://regex101.com/
-
AFAIK the file wildcard isn‘t proper regex but a OS specifix syntax that is similar to what you would use in a terminal command.
-
@d-healey Yeah thanks I already tried to learn, it is not that hard, I just don't like those regex :)
Well, so something weird happens, because I can only match the extension with
*
If I have this file
MyFile_123.txt
, the only thing that works is for the end of the name =>*.txt
(or*txt
)MyFile*
orMyFile_123*
don't work*123.txt
or*MyFile_123.txt
don't even work
In short, everything that is before the dot isn't working
FileSystem.browse(FileSystem.Desktop, false, "MyFile*", doSomething); // doesn't give access to MyFile_123.txt
@Christoph-Hart I'm pretty sure back in the days we could at least match the start of the name and not just the extension
-
@ustk It is the standard for most (if not all) file browsers that they show files based on extension. Open any app like a word processor or image editor, when you go to save/open it will filter by extension.
-
@d-healey You're certainly right then, I really thought I have filtered from the start of the name before but I'm mistaken ;)
-
A little more info from the JUCE documentation
filePatternsAllowed: a set of file patterns to specify which files can be selected - each pattern should be separated by a comma or semi-colon, e.g. "" or ".jpg;.gif". The native MacOS file browser only supports wildcard that specify extensions, so ".jpg" is OK but "myfilename*" will not work. An empty string means that all files are allowed
-
@d-healey You’ve hit it right on the nose mate! Thanks for checking ;)