[pmwiki-users] listcategories regexp question

Patrick R. Michaud pmichaud at pobox.com
Thu Nov 29 07:35:44 CST 2007


On Thu, Nov 29, 2007 at 02:11:16PM +0100, noskule wrote:
> hi list
> I try to build a regexpr that says "match all categories in the current
> group but NOT the one with the name "HomePage"
> 
> So I build this regexpr:
>     ([\d\S\w]+|(?!.HomePage))

This pattern says to return any string without spaces that
isn't followed by a character and "HomePage".  (Remember
that the '.' matches more than just a dot.)

In particular, the pattern will match "XYZ.HomePage" because 
the final "e" isn't followed by ".HomePage".

>     (:listcategories sized {*$Group}\.([\d\S\w]+|(?!.HomePage)):)
> 
> It seams to work in the regexp editor but listcategories still shows
> HomePage.
> 
> Anyone an idea what's wrong?

I'm not familiar with (:listcategories:)... but why use
regular expressions in the first place?  Wildcards are
much easier to understand -- one could then write:

    (:listcategories sized -*.HomePage :)

PmWiki's MatchPageNames() function understands wildcards --
it can be used to filter a list of pagenames for only those
matching a given pattern.

Pm



More information about the pmwiki-users mailing list