procmail
[Top] [All Lists]

Re: | vs. ? And another basic question

2003-01-09 04:59:33
procmail(_at_)deliberate(_dot_)net wrote:

On Wed, 08 Jan 2003 17:46:45 -0500 (EST), Don Hammond wrote:
=> On  8 Jan, Peterson wrote:
=> | > => :0
=> | > => * ^Received:.*[[(]209\.163.\.100.[0-9][0-9]?[0-9]?[])]
=> | > => { some action here }
=> There's a typo in the condition qouted above. There's an extra . (dot)
=> after "163".  Also, the . (dot) after 100 should be backslash escaped. 

.     Sorry about that. The above quoted typo was fixed in
detail in a later posting (in another forum as written about
earlier in the thread):
----- <snip>


      Unfortunately these character classes are sometimes very
difficult to read ... at least until one closely parses the line,
character by character, while understanding the rest of the basic
syntax.


Here are some details from my setup that may prove useful to others.
I have an INCLUDERC up-top that I call "genvars."  In genvars, I
put some longer or uglier variables I want to set.  That way, they
don't smudge up the look of the main rc, which I try to keep
readable, and whose flow I want to have be self-evident.  So this
is some stuff from genvars:


 OCTET         = "([01]?[0-9]?[0-9]|2[0-4][0-9]|25[0-5])"
 DOTQUAD       = "$OCTET\.$OCTET\.$OCTET\.$OCTET"

 # Private IP space
 SLASH_EIGHT   = "0?10\.$OCTET"                      # 10.0. - 10.255
 SLASH_TWELVE  = "172\.(0?1[6-9]|0?2[0-9]|0?3[01])"  # 172.16. - 172.31
 SLASH_SIXTEEN = "192\.168"                          # 192.168
 RESERVED_IPs  = "($SLASH_EIGHT|$SLASH_TWELVE|$SLASH_SIXTEEN)"
 

Okay, so now, back in the main rc, if I want to have a condition such
as Hammond/Peterson are discussing, I do:

        * $  ^Received:.*[[(]209\.163\.100\.$OCTET

I use the other string-vars in various places to good avail.

-- 
dman


_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail