http://www.perlmonks.org?node_id=1142850


in reply to [Solved]: Query about regular expression

I would use a parser for that instead. Here's some code to get you started should you choose this path:

use strict; use warnings; use Data::Dumper; use HTML::TokeParser::Simple; my $p = HTML::TokeParser::Simple->new( *DATA ); my $count = 0; my @array; while ( my $token = $p->get_token ) { next unless $token->is_start_tag('li'); next unless ++$count > 3; while ( $token = $p->get_token ) { last if $token->is_end_tag('li'); my $text = $token->as_is; $text =~ s/^\s*//; $text =~ s/\s*$//; push @array, $text unless $token->is_tag('br'); } last; } print Dumper \@array; __DATA__ <ul> <li><strong>site_user</strong></li> <ul> <li>user1</li> </ul> <li><strong>compare_hidden</strong></li> <ul> <li>average_speed_answer 25 60 30 60 ^M<br /> calls_waiting 300 500 300 500 ^M<br /> many more rows here post_ivr_calls_handled Wisconsin 50 100 50 100 ^M<br /> post_ivr_calls_handled Wyoming 50 100 50 100 ^M<br /> </li> <li><strong>calls_waiting_good_high</strong></li> <ul> <li>300</li> </ul> <li><strong>calls_waiting_warning_low</strong></li> <ul>

jeffa

L-LL-L--L-LL-L--L-LL-L--
-R--R-RR-R--R-RR-R--R-RR
B--B--B--B--B--B--B--B--
H---H---H---H---H---H---
(the triplet paradiddle with high-hat)