Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re: Matching multiple patterns with regex

by Athanasius (Archbishop)
on Oct 30, 2015 at 14:12 UTC ( [id://1146493]=note: print w/replies, xml ) Need Help??


in reply to Matching multiple patterns with regex

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,

Replies are listed 'Best First'.
Re^2: Matching multiple patterns with regex
by Tiarcon (Initiate) on Oct 30, 2015 at 14:16 UTC
    Thank you so much, I will give it a go rgds Tony

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1146493]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others scrutinizing the Monastery: (3)
As of 2024-04-24 23:34 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found