procmail
[Top] [All Lists]

Re: IP regex

2009-02-19 22:24:24
On 19-Feb-2009, at 19:28, Fleet Teachout wrote:
I think I just need an example that I *know* is correct.

This is the be-all and end-all of IP address regex

(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4] [0-9]|[01]?[0-9][0-9]?)

Overkill? Well, yeah. Useable as is in procmail? No, it's PCRE and procmail doesn't do PCRE.

I have this in my procmail.notes:

OCTET = "(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)"
or
OCTET   = "[01]?[0-9]?[0-9]|2([0-4][0-9]|5[0-5)"

IP    = $OCTET\.$OCTET\.$OCTET\.$OCTET
or
IP    = $OCTET[.]$OCTET[.]$OCTET[.]$OCTET

should work fine in procmail, though I am not using it.



--
You know, in a world in which Bush and Blair can be nominated for
        the Nobel Peace Prize, "for having dared to take the necessary
        decision to launch a war on Iraq without having the support of
        the UN" I find myself agreeing with Tom Lehrer: satire is dead.
        - Neil Gaiman

____________________________________________________________
procmail mailing list   Procmail homepage: http://www.procmail.org/
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail

<Prev in Thread] Current Thread [Next in Thread>