[Gambas-user] Find files without extensions using LIKE

Benoît Minisini g4mba5 at gmail.com
Tue Oct 17 22:51:50 CEST 2017


Le 17/10/2017 à 22:28, Moviga Technologies a écrit :
> Hi!
> 
> Is it possible to get all files without extensions using Dir()?
> 
> This does not work: *[^.]*
> 
> 

Of course, as the "*" will match any point in the file name.

The native regexp syntax cannot express that, you have to filter the 
result of Dir() "by hand".

As Dir() takes an integer option, I can add a new option that tells to 
return files that -do not- match the pattern. That way you will be able 
to do something like:

Dir(Directory, "*.*", gb.InvertMatch)

But I don't really like that solution.

The better would be enhancing the regexp syntax, but it's almost 
impossible without breaking backward-compatibility.

Not simple...

-- 
Benoît Minisini



More information about the User mailing list