File pattern
Posted
#1
(In Topic #1054)
Guru

Posted
Regular

For now, I am only able to suggest this :? solution:
Europaeus sum !
<COLOR color="#FF8000">Amare memorentes atque deflentes ad mortem silenter labimur.</COLOR>
<COLOR color="#FF8000">Amare memorentes atque deflentes ad mortem silenter labimur.</COLOR>
Posted
Enthusiast

https://gambaswiki.org/edit/lang/dir
this example did what you want i guess …
Code (gambas)
- ' Print png and jpeg images in the user home directory.
- PRINT FileName
hans seems to be a bit smarter than benoit ;-)
https://gambas-buch.de…k6:k6.3:start&s[]=dir#dir
Code (gambas)
Posted
Regular

Code
sdir = Dir(sPath, "\{*.jpg,*.jpeg,*.png}", gb.File)
Posted
Regular

…however, it seems :? to me that it doesn't work.thatbruce said
The pattern is a regexp expression as described in the help for LIKE.Code
sdir = Dir(sPath, "\{*.jpg,*.jpeg,*.png}", gb.File)
Europaeus sum !
<COLOR color="#FF8000">Amare memorentes atque deflentes ad mortem silenter labimur.</COLOR>
<COLOR color="#FF8000">Amare memorentes atque deflentes ad mortem silenter labimur.</COLOR>
Posted
Regular

Very interesting !PJBlack said
sPattern = "[^0-9P]*.{png,jpg,gif}"
I would also propose this string as Pattern:
Code (gambas)
- "[^.]*.\{png,jpg,gif}"
Europaeus sum !
<COLOR color="#FF8000">Amare memorentes atque deflentes ad mortem silenter labimur.</COLOR>
<COLOR color="#FF8000">Amare memorentes atque deflentes ad mortem silenter labimur.</COLOR>
Posted
Expert

Code (gambas)
I set the 'SelectedFilter to any of the variants prior to calling a file select form for whatever I'm looking for.
Cheers - Quin.
I code therefore I am
I code therefore I am
Posted
Guru

vuott. Your "*.*g" is a good workaround but is a bit hit-and-miss. I tried to use regexp, but I don't know the syntax well enough. I won't understand it if I look at it at a later date!
Quin. Your solution is close to what I have created to get around this issue.
PJBlack. I like your .Insert method. I think this is the way I will go for now.
It would be handy if Pattern was an array.
Thanks guys for your input, appreciated.
Posted
Enthusiast

Posted
Guru

Or the slightly more complicated looking version Vuott suggested.
Note: the [^.] prefix part just omits hidden files beginning with .
Posted
Regular

cogier said
thatbruce. I tried exactly the same 'solution'. vuott said it didn't work for him, and, unfortunately, it didn't work for me either.
…
It would be handy if Pattern was an array.
Yeah, I gotta eat my own soup here. I grabbed it from an old project before checking that it actually was a valid regexp as expected by Dir(). vuott's expression (and BruceS' simplification) look much more promising.
best regards
1 guest and 0 members have just viewed this.

