[Lazarus] MatchesWindowsMask('[x]','[x]') return False

Mattias Gaertner nc-gaertnma at netcologne.de
Mon Mar 16 00:05:06 CET 2020


On Sun, 15 Mar 2020 22:19:21 +0100
Bart via lazarus <lazarus at lists.lazarus-ide.org> wrote:

> On Sun, Mar 15, 2020 at 8:23 PM Mattias Gaertner via lazarus
> <lazarus at lists.lazarus-ide.org> wrote:
> 
> > IMO it should check for \[  
> 
> Using \ as an escape character isn't really a good choice IMO, since
> this function deals with filenames.

So? It is common practice on Unix since decades.

> I would be more inclined to have an option to disable sets in the
> mask.

1. Without backslashing you need sets for ? and * as well.
2. I guess this function exists only for Delphi compatibility. Regular
expression are more versatile anyway.

 
> @Rolf: you can do a StringReplace on the filename, changing '[' into
> '[[]'. That would do the trick.
> 
> Let's wait to hear what Delphi does (got no answer yet).

I can't find MatchesWindowMask in Delphi 10.3. I found MatchesMask,
which works the same. It supports [] too and I can't find any other way
than [[].


Mattias


More information about the lazarus mailing list