in reply to Are Perl patterns universal?

We can also craft patterns that loop forever (not merely a long time) (well, ignoring stack overflows that is)

#Word boundries are zero-width so the regex engine will never progress my $inf; $inf=qr/\b(??{$inf})/;
Did you try it? See perlre/Repeated patterns matching zero-length substring

Currently, you can mis-use \G to loop forever: 1 while "a" =~ /a|\G/g. Doesn't work in a single list-context ()="a"=~/a|\G/g though.

Replies are listed 'Best First'.
Re^2: Are Perl patterns universal?
by sleepingsquirrel (Chaplain) on Nov 09, 2004 at 03:30 UTC
    Did you try it?
    running this program...
    my $inf; $inf=qr/\b(??{$inf})/; print "matched" if ("abc"=~m/$inf/);
    ...under perl5.8.4 results in a "Segmentation fault" on my machine.


    -- All code is 100% tested and functional unless otherwise noted.