in reply to Re^6: How to match more than 32766 times in regex?
in thread How to match more than 32766 times in regex?
(Perls regex optimizer is pretty smart about the second regex, btw!)use strict; use warnings; my @strs = ( '010111', '0' x 1_000_000, '01' x 1_000_000, '011' x 1_000_000, ( '01' x 1_000_000 ) . '111', ); for my $str (@strs) { my $len = ( () = $str =~ m{ 0+ | 1+ }xg ) + ( $str =~ m{ 000 | 111 | (.)\1 .* (.)\2 }x ? 2 : 0 ); print $len, "\n"; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^8: How to match more than 32766 times in regex?
by Anonymous Monk on Dec 02, 2015 at 04:06 UTC | |
by Anonymous Monk on Dec 02, 2015 at 06:21 UTC | |
|
Re^8: How to match more than 32766 times in regex?
by rsFalse (Chaplain) on Dec 02, 2015 at 16:58 UTC | |
by Anonymous Monk on Dec 02, 2015 at 17:39 UTC |