[Mimedefang] RelayAddr
Matthew.van.Eerde at hbinc.com
Matthew.van.Eerde at hbinc.com
Fri Sep 20 16:59:00 EDT 2002
To be pedantic, the only IP address that matches
/^127.0.0.1$/
is
'127.0.0.1'
In fact, there is nothing special about the number of digits in each byte.
Since every IP address has exactly three periods, you can test against
/^(\d{1,3})(.)(\d{1,3})(.)(\d{1,3})(.)(\d{1,3})$/
and bet your life that
$2 eq "." and $4 eq "." and $6 eq "."
and further that
"$1.$3.$5.$7" is the original IP address.
That said, it is still a good idea to keep in the habit of escaping . inside
// - it's just better practice to test against
/^127\.0\.0\.1$/
than against
/^127.0.0.1$/
Also note that since you're testing against a literal in the first option
instead of a pattern, it should run much faster than the second option.
> -----Original Message-----
> From: Ashley M. Kirchner [mailto:ashley at pcraft.com]
> Sent: Friday, September 20, 2002 13:26
> To: mimedefang at lists.roaringpenguin.com
> Subject: Re: [Mimedefang] RelayAddr
>
>
> Nels Lindquist wrote:
>
> > <INIGO>
> > I do not think this regular expression means what you think
> it means.
> > </INIGO>
> >
> > Remember that "." (dot) is a special character in perl regexps. I
> > think you mean 127\.0\.0\.1.
>
> I have this working on an older installation of MD just
> fine. It picks it
> up as is. $LocalNetworks on the other hand does escape the
> dots. Don't ask me
> why, nor how, but it works.
>
> --
> W | I haven't lost my mind; it's backed up on tape somewhere.
>
> +--------------------------------------------------------------------
> Ashley M. Kirchner <mailto:ashley at pcraft.com> .
> 303.442.6410 x130
> IT Director / SysAdmin / WebSmith .
> 800.441.3873 x130
> Photo Craft Laboratories, Inc. . 3550
> Arapahoe Ave. #6
> http://www.pcraft.com ..... . . . Boulder, CO
> 80303, U.S.A.
>
>
>
> _______________________________________________
> MIMEDefang mailing list
> MIMEDefang at lists.roaringpenguin.com
> http://lists.roaringpenguin.com/mailman/listinfo/mimedefang
>
More information about the MIMEDefang
mailing list