If you want to do your matching about the whole string (containing multiple lines), then you want /s (also let the dot meta character match line breaks).
my ($body) = $line =~ /^body: \n (.*) \n attachment/xsi;
Or you are matching line by line, then you should have a look at the flip-flop operator in perlop.
# this is from perlop while (<>) { $in_header = 1 .. /^$/; $in_body = /^$/ .. eof; if ($in_header) { # ... } else { # in body # ... } }
--Frank
In reply to Re: Multiline regex
by haoess
in thread Multiline regex
by mhearse
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |