|Think about Loose Coupling|
String Matchingby stevbutt (Novice)
|on Aug 13, 2012 at 23:41 UTC||Need Help??|
stevbutt has asked for the
wisdom of the Perl Monks concerning the following question:
Please help with some wise and efficient string matching wisdom
Input :May 2 04:06:15 lon.mail.net exim: 2012-07-03 07:06:15 1SPPtO-0004en-PS <= firstname.lastname@example.org H=smtpout.mail.com [18.104.22.168] I=[22.214.171.124]:25 P=esmtp S=13333 email@example.com T="Half price offer"
I want to grab the IP address ( 126.96.36.199 without the square brackets ) the email address ( firstname.lastname@example.org which always follows <= )
so far I have the ip address but with the square brackets using :my ($srvrip) = $remainder =~ m/H=.+?(\[.+?\])/;
How can I extract the email address ?
I have a lot of lines in the log files so need this to be as efficient as possible and am also restricted to perl 5.8.4
Hope you can help