Hello Tiarcon, and welcome to the Monastery!
Just letting you know that you don’t have to use regular expressions for this. has dedicated modules for reading email. For example:
#! perl use strict; use warnings; use Email::Simple; my $file = 'YourEmailHere.eml'; open(my $fh, '<', $file) or die "Cannot open file '$file' for reading: $!"; my $text = do { local $/; <$fh>; }; close $fh or die "Cannot close file '$file': $!"; my $email = Email::Simple->new($text); my $from = $email->header('From'); my $subject = $email->header('Subject'); print "FROM: $from\n"; print "SUBJECT: $subject\n";
See Email::Simple.
Hope that helps,
| Athanasius <°(((>< contra mundum | Iustus alius egestas vitae, eros Piratica, |
In reply to Re: Matching multiple patterns with regex
by Athanasius
in thread Matching multiple patterns with regex
by Tiarcon
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |