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

Etusivu
Poista viesti
Lähettäjä: Herczeg Zoltán
Päiväys:  
Vastaanottaja: ND
Kopio: Pcre-dev
Aihe: Re: [pcre-dev] Assertions with quantifier behaviour is Perl incompatible
Hi,

assertion which does not needs to be true, some kind of logical contradiction :) Funny construct. It is true, that you may have several forms to achive the same purpose, but I would prefer a conditional block here since that would be much more reasonable: (?(?=a(b)))

Regards,
Zoltan

ND <nadenj@???> írta:
>On 2011-05-02 13:13, Herczeg Zoltán wrote:>
>
> You get the same result if you simply drop the quantifier.>

No. Try Perl example>
(?=a(b))?.*d\1?>
against subject 'axbdb' with '?' after assertion and without it.>
Results are different.>
>
> Anyway, if you really need the quantifier, just put a non-capturing >
> bracket around it.>

Thanx. But the the aim of my post is not to get help about converting such >
expressions to non erroneous variation in PCRE.>
There are many other cases when converting may be done. But they don't >
cause banning of other legal Perl constructions.>
For example Perl expression 'a{2}' may be rewritten as 'aa'. But this is >
not mean that construct '{2}' must be disallowed in PCRE as erroneous.>
>

If it seems to be unuseful to repeat assertions more than one time than >
PCRE can optimize such quantifiers at compile time to run an assertion >
only once.>
The ability to repeat an assertion 0 or 1 times is useful (example above).>
I don't see a need to break compatibility with Perl in such cases.>
>

Best regards.>
>
>

-- >
## List details at https://lists.exim.org/mailman/listinfo/pcre-dev