Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re^9: How to match more than 32766 times in regex?

by Anonymous Monk
on Dec 02, 2015 at 06:21 UTC ( [id://1149120]=note: print w/replies, xml ) Need Help??


in reply to Re^8: How to match more than 32766 times in regex?
in thread How to match more than 32766 times in regex?

Mkay, I believe that's the final version:
use strict; use warnings; use feature 'say'; use List::Util 'min'; my @strs = ( '0' x 1_000_000, '01' x 1_000_000, '011' x 1_000_000, '0110' x 1_000_000, ); for (@strs) { my $l = length(tr/01//sr); my $d = length() - $l; say $l + min( $d, 2 ); }

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (3)
As of 2024-04-19 23:18 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found