in reply to Re: Tracking consecutive characters
in thread Tracking consecutive characters

Here are variants that matches multiple times:

$_ = 'Wow!!!!! simply wow!!!'; @lengths = map { length } /(!{2,})/g;

or

$_ = 'Wow!!!!! simply wow!!!'; push(@lengths, length($1)) while (/(!{2,})/g);

Replies are listed 'Best First'.
Re^3: Tracking consecutive characters
by tachyon (Chancellor) on Sep 27, 2004 at 05:41 UTC

    And if you just want to know the maximum string of consecutive !

    $max = ( sort {$b<=>$a} map{length} /(!{2,})/g )[0];