Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re^3: Is it safe to use external strings for regexes? (infinite loops)

by choroba (Cardinal)
on Oct 11, 2021 at 13:29 UTC ( [id://11137417]=note: print w/replies, xml ) Need Help??


in reply to Re^2: Is it safe to use external strings for regexes? (infinite loops)
in thread Is it safe to use external strings for regexes?

Huh?
$ perl -wE '$f = "foo"; say pos $f while $f =~ m{ ( o? )* }gx;' 0 3 3

map{substr$_->[0],$_->[1]||0,1}[\*||{},3],[[]],[ref qr-1,-,-1],[{}],[sub{}^*ARGV,3]

Replies are listed 'Best First'.
Re^4: Is it safe to use external strings for regexes? (infinite loops)
by LanX (Saint) on Oct 11, 2021 at 15:36 UTC
    dunno, I just RTFM and copied it here! :)

    maybe some delta fixed it?

    Cheers Rolf
    (addicted to the Perl Programming Language :)
    Wikisyntax for the Monastery

      Maybe. It doesn't loop even on 5.16.3 which is the oldest Perl easily available to me.

      Update: 5.10.1 neither.

      Update2: It loops in 5.6.2!

      map{substr$_->[0],$_->[1]||0,1}[\*||{},3],[[]],[ref qr-1,-,-1],[{}],[sub{}^*ARGV,3]
        I always thought we need tests for snippets in perldocs too.

        Cheers Rolf
        (addicted to the Perl Programming Language :)
        Wikisyntax for the Monastery

      Nor on 5.8.9:

      Win8 Strawberry 5.8.9.5 (32) Mon 10/11/2021 13:52:47 C:\@Work\Perl\monks >perl -wMstrict -le "my $f = 'foo'; print pos $f while $f =~ m{ ( o? ) +* }gx;" 0 3 3


      Give a man a fish:  <%-{-{-{-<

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11137417]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others pondering the Monastery: (3)
As of 2024-04-24 14:56 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found