in reply to Re^2: is perl's regular expression engine reentrant ? (works)
in thread is perl's regular expression engine reentrant ?

I suppose you are saying that reentrancy is only an issue with ?{code} and ??{code} constructs.

This is in fact an issue. The following one-liner will segfault (with perl 5.8.8):

perl -we '"_" =~ m{(??{"_" =~ /./})}'

Replies are listed 'Best First'.
Re^4: is perl's regular expression engine reentrant ? (works)
by grinder (Bishop) on Apr 27, 2007 at 09:58 UTC

    With the extensive rewrite of the regular expression engine, by dave_the_m and demerphq, that particular expression works just fine in the development version (what will become 5.10).

    % perl5.9.5 -wle 'print +("_" =~ m{(??{"_" =~ /./})}) ? 1 : 0' 0 % perl5.9.5 -wle 'print +("_" =~ m{(??{"_" !~ /./})}) ? 1 : 0' 1

    There exist, however, more exotic code constructs that will trip up reentrancy bugs.

    • another intruder with the mooring in the heart of the Perl

Re^4: is perl's regular expression engine reentrant ? (works)
by plank (Novice) on Apr 27, 2007 at 08:13 UTC
    Again thank you for clarifying this with an example. You have been most helpful.

    If I find any extra info regarding this I will try to append it top the question for future reference.