|
|
| P is for Practical | |
| PerlMonks |
String Matchingby stevbutt (Novice) |
| on Aug 13, 2012 at 23:41 UTC ( #987241=perlquestion: print w/ replies, xml ) | Need Help?? |
|
stevbutt has asked for the
wisdom of the Perl Monks concerning the following question:
Hello Monks Please help with some wise and efficient string matching wisdom Input : May 2 04:06:15 lon.mail.net exim[17905]: 2012-07-03 07:06:15 1SPPtO-0004en-PS <= me@ours.co.uk H=smtpout.mail.com [22.5.10.4] I=[6.5.14.4]:25 P=esmtp S=13333 id=6aeca3b79b8892d6105dab131c76f066@localhost.localdomain T="Half price offer"I want to grab the IP address ( 22.5.10.4 without the square brackets ) the email address ( me@ours.co.uk 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
Back to
Seekers of Perl Wisdom
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||