try out
(\d+\.){3}(\d+)
but it won't take CIDR addresses and will not check
the validity of the addresses.
--- Griggs Rob <[EMAIL PROTECTED]> wrote:
> Hi Guys,
>
> The code below extracts an ip address from the
> /var/log/maillog file in the
> event of the line containing the words "rej
Griggs Rob wrote:
>
> Hi Guys,
Hello,
> The code below extracts an ip address from the /var/log/maillog file in the
> event of the line containing the words "reject=550". It works fine, but is
> there a way of shortening that regular expression?
You can save six characters by removing the '$_
[EMAIL PROTECTED]]
> Sent: 19 September 2002 18:36
> To: [EMAIL PROTECTED]
> Subject: Re: regex and ip address extraction
>
>
> Griggs Rob wrote:
>
> > Hi Guys,
> >
> > The code below extracts an ip address from the
> /var/log/maillog file in
> > the e
Griggs Rob wrote:
> Hi Guys,
>
> The code below extracts an ip address from the /var/log/maillog file in
> the event of the line containing the words "reject=550". It works fine,
> but is there a way of shortening that regular expression?
>
> open(LOG,"/var/log/maillog");
>
> while() {
/\[(\d+\.\d+\.\d+\.\d+)\]/
hmmm...maybe this?
/\[((?:\d+\.){3}\d+)\]/
#non-capturing parens group for {3}, nested in $1 parens
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]