[dokuwiki] Re: back references in syntax plugin regex?

  • From: Simon Elliot <hendrybadao@xxxxxxxxxxxxxx>
  • To: dokuwiki@xxxxxxxxxxxxx
  • Date: Tue, 04 May 2010 20:58:56 +0200


On 04-May-2010 20:38, Andreas Gohr wrote:
2010/5/4 Elan Ruusamäe<glen@xxxxxxxx>:
On Tuesday 04 May 2010 14:39:10 Simon Elliot wrote:
Ahhh... if only it were that simple!  Thanks for the thought, but the
regex: "\w{3}" would mean any 3 alphanumeric word characters, not the same
character repeated 3 times.  So it would recognise "abc" "iou "imo" etc...,
as well as 'aaa', 'bbb'.
whoops, you're right! but you can still do (\w)\1{3} i suppose :P
No you can't. Read Chris' answer instead of guessing.

Simon, if you really just need 3 letters you could just write them all
in a non-catching group: (?:aaa|bbb|ccc|ddd|....|xxx|yyy|zzz)

Not elegant but could be a solution.

Andi


That was going to be my next option, but very difficult to internationalise... it would work fine for english and romantic languages, but what about asiatic and indic languages. So I'm stumped for now.

I was hoping to use the idea to create in-place unique 'tags' (taking full advantage of the built-in search functions to look for and group them; I'm doing this already in my personal wiki by hacking the allowed characters in the indexer to include the '&' symbol. This allows me to create unique tag words by just typing them in-line, e.g &tag. I then have a couple of plugins that recognise these tags and format them correctly, and display them in clouds or tables. It works really well, but I just don't like having to hack the Dokuwiki source to achieve it)

Simon




--
DokuWiki mailing list - more info at
http://www.dokuwiki.org/mailinglist

Other related posts: