Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re^2: Is it safe to use external strings for regexes?

by LanX (Saint)
on Oct 07, 2021 at 20:58 UTC ( [id://11137318]=note: print w/replies, xml ) Need Help??


in reply to Re: Is it safe to use external strings for regexes?
in thread Is it safe to use external strings for regexes?

My guess: Perl is looking for exact strings from both ends, your regexes include a trailing "b" but your string $futile doesn't

This simplified demo seems to support my theory

D:\tmp\pm>perl -Mre=debug -E"'aaaa' =~/a*a*b/" Compiling REx "a*a*b" synthetic stclass "ANYOF[ab]". Final program: 1: STAR (4) 2: EXACT <a> (0) 4: STAR (7) 5: EXACT <a> (0) 7: EXACT <b> (9) 9: END (0) floating "b" at 0..9223372036854775807 (checking floating) stclass ANY +OF[ab] min len 1 Matching REx "a*a*b" against "aaaa" Intuit: trying to determine minimum start position... doing 'check' fbm scan, [0..4] gave -1 Did not find floating substr "b"... Match rejected by optimizer Freeing REx: "a*a*b"

please note Did not find floating substr "b"... Match rejected by optimizer

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

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others perusing the Monastery: (5)
As of 2024-04-25 13:17 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found