|Welcome to the Monastery|
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 <= email@example.com H=smtpout.mail.com [22.214.171.124] I=[126.96.36.199]:25 P=esmtp S=13333 firstname.lastname@example.org T="Half price offer"
I want to grab the IP address ( 188.8.131.52 without the square brackets ) the email address ( email@example.com 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