Re: [pcre-dev] Assertions with quantifier behaviour is Perl …

Etusivu
Poista viesti
Lähettäjä: Philip Hazel
Päiväys:  
Vastaanottaja: ND
Kopio: Pcre-dev
Vanhat otsikot: Re: [pcre-dev] Assertions with quantifier behaviour is Perl incompatible
Aihe: Re: [pcre-dev] Assertions with quantifier behaviour is Perl incompatible
On Mon, 2 May 2011, ND wrote:

> Why when user ports to PCRE a successfull Perl pattern like
> (?=a(b))?.*d\1? (it's simplifyed version of real pattern used by my
> application)
> he need to look for difficulties to reconstruct it?


I have just committed a patch that allows quantifiers on parenthesized
assertions such as the example above. There are only three relevant
cases:

  {0} never runs the assertion, but any groups inside it may be used
      via code such as (?1)


{n,m} where n > 0 is in effect ignored: the assertion is run once

  {0,n} is treated as {0,1}: the rest of the match is tried with and
        without the assertion (the order depends on greediness).    


I have NOT enabled quantifiers for assertions such as \b or ^ or $.

Philip

--
Philip Hazel