procmail
[Top] [All Lists]

Re: matching nulls

2002-01-08 14:29:22
OK, Paul, let's tackle this.

| I could crop what I match with:
|
|  * MATCH ?? [^a-z0-9]*\/[a-z0-9.-]+

Matching is stingy to the left of \/, so the left side of that regexp would
be matched to null (but not in the way you want).

| Is this an unwarranted whine?

Not really, but

| Am I just being uppity and lazy about an insignificant design issue here?

You could cope with it the way the rest of us do.

| Should I really use constructs like:
|
|  * $ ^Return-Path:(_dot_)*(_at_)\/$FREESERVICES\>
|  * MATCH ?? \/[a-z0-9.-]+

Close:

  * $ ^Return-Path:(_dot_)*(_at_)\/$FREESERVICES\>
  * MATCH ?? ()\/[-a-z0-9.]+

| or include the \< and \> in the FREESERVICES variable and make sure all
| my uses of it are wrapped to suit?

No, don't do that; it's too easy to mess up on a future edit.

| Or might it possibly be safe to
| assume that FREESERVICES will never be immediately followed by [a-z0-9_]?

Well, it's a sticky case.  \> will match a hyphen or a period, which you
don't want it to do, especially if the domain is of the Australian or
Brazilian style, where "com" or "net" and the end of a string in your
pattern is followed by a period and the country's two-letter domain park;
you want the rest of the domain in $MATCH.  \> will also match a right-side
angle bracket, which I'm guessing is what you really want to exclude, since
you are extracting from the Return-Path: header.

Have you ever considered,

 * $ ^Return-Path:(_dot_)*(_at_)\/$FREESERVICES[^>]*

That would prevent extracting the closing right-side angle bracket but still
get you the rest of the domain if it begins with one of the alternates in
$FREESERVICES.

So let's see ...

 # second pair of brackets enclose space, tab, period
 :0fwh # no reason to throw body into this filter
 * $  ^From:(_dot_)*(_at_)\/$FREESERVICES[^>]*
 * !$ ^Received:.*[     .]$MATCH\>
 | formail -A "X-spamtrap: return address is free provider, but message
didn't originate there"

| Or is there some way to match nulls that I simply haven't been able to
| find?

You don't really want to match nulls; you want to stop the match without
including the non-word character to the right.

| Is there some undocumented variable I can set which tells
| procmail to treat \< and \> the way grep does instead of the way it
| historically has treated them?

Not without forking some other utility that does it the way you want.



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

<Prev in Thread] Current Thread [Next in Thread>
  • matching nulls, Paul Chvostek
    • Re: matching nulls, David W. Tamkin <=