use strict; my $data = join("", <DATA>); print "data:\n$data"; # loop for each heading while ($data =~ /\s*(.*?):\s*\n((.|\n)*?\n)(?=(\s*\w+:|\Z))/gc) { print "heading: $1\n"; my $text = $2; while ($text =~ /\s{9}(.*?)\n/gc) { print "line item: $1\n"; } } exit; __DATA__ Paragraph1: text Paragraph2: text1 text2 text3 Paragraph3: text
In reply to Re: Regexp help, multiple lines
by spoulson
in thread Regexp help, multiple lines
by 2ge
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |