--- On Wed, 2/3/10, Bernd Petrovitsch <[email protected]> wrote:
> On Die, 2010-02-02 at 17:49 -0800, - wrote:
> > Try this regex for detecting an IPv4-compatible IPv6 address:
> >
> > ... =~ qr/^::FFFF:(\d{1,3}(\.\d{1,3}){3})$/i ...
>
> To get even more anal: No one forbids to avoid the leading "::" or
> write the optional "0" before and(or after it. So that could be
> ---- snip ----
> ... =~
> qr/^((0+:)*::(0+:)*|(0+:){6})FFFF:(\d{1,3}(\.\d{1,3}){3})$/i
> ...
A human may write that, but the routines for converting IPv6 to text never
will. They will output only in the first format appearing above, even if the
latter is a possible equivalent. The leading zero-quads will never appear in a
machine generated address.
Using the latter-above code, $2 is the IPv4, and if $1 is anything other than
"::", then the address was not machine generated and it's likely that the
message was manually tampered with (and thus spam).
_______________________________________________
NOTE: If there is a disclaimer or other legal boilerplate in the above
message, it is NULL AND VOID. You may ignore it.
Visit http://www.mimedefang.org and http://www.roaringpenguin.com
MIMEDefang mailing list [email protected]
http://lists.roaringpenguin.com/mailman/listinfo/mimedefang