Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re^3: Faster regex to split a string into runs of similar characters?

by dave_the_m (Monsignor)
on Nov 21, 2016 at 14:16 UTC ( [id://1176251]=note: print w/replies, xml ) Need Help??


in reply to Re^2: Faster regex to split a string into runs of similar characters?
in thread Faster regex to split a string into runs of similar characters?

On a related note: Any ideas why this:
while( substr( $$str, $y * $WIDTH, $WIDTH ) =~ m[((.)\2*)]mg ) { ...
Works (runs to completion, produces the desired results) on 5.10.1, but silently loops forever in 5.22.0?
Looks like a bug fix. expr =~ /.../g attaches position magic to the LHS after each match, to record the current pos() for that expression. If expr is a var or similar this works well; if expr returns something new each time, the old pos magic gets lost.

This similarly loops forever:

sub f { "abc" } 1 while f() =~ /./g;

Dave.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others chilling in the Monastery: (5)
As of 2024-04-23 20:34 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found