|Syntactic Confectionery Delight|
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 [188.8.131.52] I=[184.108.40.206]:25 P=esmtp S=13333 email@example.com T="Half price offer"
I want to grab the IP address ( 220.127.116.11 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