[pmwiki-users] Re: search pattern

Patrick R. Michaud pmichaud at pobox.com
Wed Jul 6 12:16:03 CDT 2005


On Wed, Jul 06, 2005 at 10:06:31AM -0700, Jan Peters wrote:
> I pruned the code down to
> 
> <?php  if (!defined('PmWiki')) exit();
>   Markup('search','_begin','/\(:search *(.+):\)/e',"search('\$1')");

Hmmm, that search pattern is wrong there -- there needs to be
a '?' after the '+', otherwise the pattern is too greedy and grabs
much more than just the (:search:) directive.  Try:

    Markup('search','_begin',
      '/\\(:search\\s*(.+?):\)/e',"search('\$1')");

Also, I think that putting this rule so early in the sequence ('_begin')
is probably not a good idea -- it might fit better in the 'directives'
section.

Pm



More information about the pmwiki-users mailing list