[dokuwiki] Re: Search pattern challenge for plugin

  • From: "Martin Tschofen" <martin.tschofen@xxxxxxxxx>
  • To: dokuwiki@xxxxxxxxxxxxx
  • Date: Wed, 27 Dec 2006 17:25:24 -0600

The only reason I wanted to use square brackets is the need for less typing,
in this case the shift key and in my opinion square brackets stand out
better, but that is just subjective.
I really appreciate you're help with this and I'll just use {} instead.
Thanks again...martin

On 12/27/06, Chris Smith <chris@xxxxxxxxxxxxx> wrote:

Martin Tschofen wrote:
> So obvious, that does the trick. Thanks a lot for pointing this out.
> Got another one if the pattern is preceeded by a [[reveal wide
> 10%|[[link]]/] DW thinks it's a link and gobbles it all up. I tried a
> negative lookbehind: (?>!\[) before the pattern, but DW still thinks
> it's a
> link. Tried various sorts without success.
>
> Thanks...martin
>
Two problems.

- sorts don't stop another pattern matching.  DW prioritises the pattern
that matches earlier in the string.  The link syntax will match on the
first [, one character earlier than your pattern.  When two patterns can
match at the same character, DW will favour the pattern with the lower
sort order.

- negative look behind at the start of a pattern is not guaranteed to
work. DW parses the wiki text incrementally, each subsequent match
attempt starts at the next character after the last successful match.

Why is it important to use square brackets?  Wouldn't it make things
easier to use curly brackets or angle brackets?

Are you attempting a slight variation on the folded plugin?  Can you use
its syntax?

Cheers,

Chris
--
DokuWiki mailing list - more info at
http://wiki.splitbrain.org/wiki:mailinglist

Other related posts: