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 "reject=550".
> It works fine, but is
> there a way of shortening that regular expression?
>
> open(LOG,"/var/log/maillog");
>
> while(<LOG>) {
> chomp;
> if($_ =~ /reject=550/) {
>
> if($_ =~ /\[(\d+\.\d+\.\d+\.\d+)\]/)
> {
> $address = $1;
>
> # Add address to firewall filtering here
> }
>
> }
>
> }
> close(LOG);
>
>
> Thanks
>
> Rob
>
>
> --
> Email Disclaimer can be viewed at:
> http://www.netscalibur.co.uk/email.html
> --
>
> --
> To unsubscribe, e-mail:
> [EMAIL PROTECTED]
> For additional commands, e-mail:
> [EMAIL PROTECTED]
>
__________________________________________________
Do You Yahoo!?
Everything you'll ever need on one web page
from News and Sport to Email and Music Charts
http://uk.my.yahoo.com
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]