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

  • From: Simon Elliot <hendrybadao@xxxxxxxxxxxxxx>
  • To: dokuwiki@xxxxxxxxxxxxx
  • Date: Tue, 4 May 2010 13:39:10 +0200

2010/5/4 Elan Ruusamäe <glen@xxxxxxxx>

> On Sunday 02 May 2010 20:34:16 Simon Elliot wrote:
> > Just a simple question for the experts out there:  is it possible to use
> > back references in a syntax plugin regex pattern?  I'm trying to look
> > for words with tripled letters at the beginning, i.e. the first 3
> > characters are the same, e.g. aaa bbb ccc, etc... I'm using the
> > following regex, but it is not being recognised by the lexer:
> >
> > "\w\1\1\w+"
>
> well, you seem to be beeding just \w{3} here (\w repeated 3 times)
>
> > Am I doing something wrong or is it just not possible?
> >
> > Many thanks for your help,
> >
> > Simon
>
> --
> glen
> --
>

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'.

Other related posts: