[pmwiki-devel] MatchPageNames

Patrick R. Michaud pmichaud at pobox.com
Tue May 22 17:22:30 CDT 2007


On Tue, May 22, 2007 at 11:02:18PM +0100, Hans wrote:
> Tuesday, May 22, 2007, 10:17:44 PM, Patrick wrote:
> >>    echo (boolean)MatchPageNames('Forum.Test1','-PmWiki.*,-Site.*');
> >> 
> >> will echo 1.
> >> But the target page is not part of the pattern.
> 
> > Ummmm, yes it is.  The pattern says "all pages that are not
> > in the PmWiki or Site groups", and since 'Forum.Test1' isn't
> > in either of those groups, it matches the pattern.
> 
> This means that for this purpose of checking exactly one pagename
> against a pattern of excluded and included page names, if no included
> page names are in the pattern it means including all pages (except the
> excluded pages).
> 
>   echo (boolean)MatchPageNames('Forum.Test','-PmWiki.*,-Site.*,Main.*');
> 
> will return nothing, but
> 
>   echo (boolean)MatchPageNames('Forum.Test','-PmWiki.*,-Site.*');
> 
> will return 1.
> 
> Hmmm, this is unexpected. [...]
> I would find it more logical if the absence of an inclusive pattern
> means no match. How can I achieve that?

I'm afraid I totally don't understand.

In a pagelist command, if someone does

    (:pagelist name=-PmWiki.*,-Site.* :)

then they expect to see all pages that aren't in the PmWiki or Site
groups.  They don't expect it to return zero pages because there
weren't any inclusive patterns in the wildcard list.

Put another way, given your interpretation, when would

    echo (boolean)MatchPageNames($something, '-PmWiki.*,-Site.*');

ever return someting other than false?  And why would having a pattern
that always returns false be useful?

If you just want something to filter out all pages, use either

    echo (boolean)MatchPageNames($something, '-*.*');

or even

    echo false;

Pm



More information about the pmwiki-devel mailing list