in reply to Re: regex help
in thread regex help
there are other 'pages' so i might set a counter and after the first match do $match{PAGE . $count} = $split$i ... if i end up caring - i don't think i do.my @split = map { s/^\[|\]$//m; $_ } split /\]\n[\S ]*\[|\n{2 +,}/, $text; my %match; for my $i (0 .. $#split) { my ($sec, $desc); ($match{PAGE}) = $split[$i] =~ /Pages? ([\d-]+)/ if (!defi +ned($match{PAGE})); ($sec, $desc) = $split[$i] =~ m/^([A-Z]+):\s*(.*)/msg; $match{$sec} = $desc if ($sec and $desc); if (($match{ACTION} or $match{AGENCY}) and !$match{DESC}) +{ $match{DESC} = $split[$i - 1]; } }
|
|---|