Re: [pcre-dev] ?(DEFINE) assertion problem

Página superior
Eliminar este mensaje
Autor: Philip Hazel
Fecha:  
A: ND
Cc: Pcre-dev
Asunto: Re: [pcre-dev] ?(DEFINE) assertion problem
On Sat, 1 Aug 2009, ND wrote:

> Pattern:
> (?&word)(?&element)(?(DEFINE)(?<element><[^m][^>]>[^<])(?<word>\w*+))
> Compilation error:
> reference to non-existent subpattern at 8 position
>
> Substitute 'm' with '\d' in pattern string :
> (?&word)(?&element)(?(DEFINE)(?<element><[^\d][^>]>[^<])(?<word>\w*+))
> Compilation:
> OK


I have committed a patch that fixes this bug. It was nothing to do with
DEFINE. It was an "off-by-one" bug when looking for the forward
reference to the "word" subpattern: elements such as [^m] (with only one
character) were not being correctly skipped. A simpler pattern that also
fails is:

(?&A)(([m])(?<A>))

The fix will be in the next release.

Philip

--
Philip Hazel