mhearse has asked for the wisdom of the Perl Monks concerning the following question:
First I tried a more restrictive:Oct 9 08:50:53 mail_server sendmail[30172]: j99FopoN030172: from=<sup +port@symantec.com>, size=0, class=0, nrcpts=0, proto=ESMTP, daemon=MT +A, relay=[218.1.114.182]
Then I tried the less restrictive:if ($line =~ /relay\=\[?(.*?)\]?/) { $server = $1; }
The regex matches FQDNs fine, but not ip addresses. I need to be able to match both FQDNs and IPs. The brackets, server name are present only for IP addresses. Is the problem obvious to anyone? Thanks.if ($line =~ /relay\=(.*?)/) { $server = $1; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Help with pattern matching
by Aristotle (Chancellor) on Oct 09, 2005 at 23:57 UTC | |
|
Re: Help with pattern matching
by GrandFather (Saint) on Oct 10, 2005 at 00:02 UTC | |
|
Re: Help with pattern matching
by pg (Canon) on Oct 09, 2005 at 23:47 UTC | |
by mhearse (Chaplain) on Oct 09, 2005 at 23:53 UTC | |
by pg (Canon) on Oct 10, 2005 at 00:00 UTC | |
by Aristotle (Chancellor) on Oct 10, 2005 at 00:07 UTC |