[Top] [All Lists]

Re: IP regex

2009-02-19 21:46:48
At 21:28 2009-02-19 -0500, Fleet Teachout wrote:
For example (made up) the range of IPs is:

The last octet is getting me.

I've tried [0-2][0-9][0-9] but in the back of my mind something says "that ain't right!)

One, it'll expect 000 or 001, which isn't how single digit values are represented, and it'll allow up to 299, which is in excess or the maximum value in a valid octet.

The following should work to specify a 0-255 value, allowing for optional leading zeroes on values which might otherwise be represented in single or double digits:


And is they *any* way to test a regex in actual procmail format? Grep/egrep differ enough that I'm never sure I've got it right.

Sandbox it and throw a known range of values at it.

 Sean B. Straw / Professional Software Engineering

 Procmail disclaimer: <>
 Please DO NOT carbon me on list replies.  I'll get my copy from the list.

procmail mailing list   Procmail homepage:

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