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

  • From: Andreas Gohr <andi@xxxxxxxxxxxxxx>
  • To: dokuwiki@xxxxxxxxxxxxx
  • Date: Tue, 4 May 2010 20:38:12 +0200

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


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

Other related posts: