[pmwiki-users] Problem with $SearchPatterns

Peter & Melodye Bowers pbowers at pobox.com
Sun Jun 29 14:32:41 CDT 2008

> One last question: I understand that the ! is the exclude parameter, but
> I didn't find if I have to use \\ or \ behind my group?
> What's the difference between \ and \\ ? Are both wildcards? In my case
> it works and it does not find content which is e.g. in Group P0035, but
> I would like to understand it 100% ;-)
> Is there an explanation article around which explains ^, \ ?

As Petko has already documented and very helpfully explained, you're dealing
with regular expressions here.

What is not documented anywhere that I see with regard to $SearchPatterns is
that simple wildcards work fine as the values for $SearchPatterns
(optionally prefixed with a - or ! to make it an exclusive pattern rather
than an inclusive one.)

So the following 2 sets of lines are functionally identical:

 $SearchPatterns['default'][] ="/^(De|CRM|FAQ|Glossar)\\./"; # allowed
 $SearchPatterns['default'][] ="!^P.*\\.!"; # excluded


 $SearchPatterns['default'][] ="De.*,CRM.*,FAQ.*,Glossar.*"; # allowed
 $SearchPatterns['default'][] ="-P*.*";                      # excluded

While regular expressions are incomparable in terms of their pure power, the
wildcards in the second set of examples are a lot more readable for most...


More information about the pmwiki-users mailing list