[pmwiki-users] MatchPagenames() usage

Peter & Melodye Bowers pbowers at pobox.com
Sun Mar 23 23:54:22 CDT 2008

I just added a comment to the Cookbook/Functions page regarding the
MatchPagenames(), but I want to confirm it and then see if it's by design or
a bug...

Here's the entire entry for MatchPageNames() - my comment is the 2nd

MatchPageNames($list, $patterns)
    Returns a matched new list of page names. $list is a pagename or array
of pagenames, and $patterns is an array of patterns to be matched. If a
pattern starts with a slash, the pagename must match the pattern, else if
the pattern starts with an exclamation point, the pagename must not match
the pattern, else the pagename must match the wildcard pattern. Mixed use of
regex pattern and wildcards possible. 

Note that individual elements of the $patterns array can consist of
comma-separated wildcard patterns. This (or regex with |) is the way to
accomplish inclusive "or" conditions. Each element of the $patterns array is
combined with the others by boolean "and". For inclusion this can be
confusing since 2 elements of the array holding "GroupA.*" and then
"GroupB.*" respectively will mean that no page is ever matched. GroupA.Page1
will match and so be included by the 1st element but will not match the 2nd
element of the array and so will not be included.  If you want all pages in
both GroupA and GroupB then your array must include a SINGLE array element
containing the string 'GroupA.*,GroupB.*'.

I had been assuming that this setting:


was the way to specify multiple groups that could match - when I do this I
end up with EVERYTHING being excluded, much to my surprise.  The
multi-element inclusion gives nice functionality in my context, but maybe
not in other contexts where only a single inclusive element would ever be

Is this by design or by accident?  Why would you ever want 2 inclusive
patterns combined by boolean "and"?


More information about the pmwiki-users mailing list