procmail
[Top] [All Lists]

Re: Isolating the hyphen

2004-05-16 11:43:09
At 13:03 2004-05-16 -0400, fleet(_at_)teachout(_dot_)org wrote:
I'm trying to construct a recipe to snag a specific pattern in the
Message-ID header line.  A sample Message-ID looks like:

# Message-Id: <E1BO2fg-0002He-HQ(_at_)ocjnet(_dot_)com>

My recipe is:

A=[a-zA-Z0-9]

Unless you specify the D flag on the flags line, procmail is case INsensitive, so there's no need to include both cases of alphabetic characters in your character class.

:0
* $ ^message-id:[       ]<$A$A$A$A$A$A$A-$A$A$A$A$A$A-$A$A
spam

If it's a FILE, you're missing the locking flag...

I can't seem to isolate the "-".  I've tried "\-", "\\-". [-], [\-].  I've
even tried assigning F="-" and including $F in the recipe.

Are you running this in a sandbox and confirming the above recipe is actually being executed (say, there may be an error preceeding it which boffs the interpretation). That recipe should match the message-id syntax you posted.

Grep man pages state that a "-" included in a class should be placed last
inside the [], so I guess [-] would not be expected to work.

I've generally included it _first_. hyphen is pretty meaningless unless it's BOUNDED by characters - if it is the first character in the set, there isn't a start point preceeding it, and thus it is interpreted as a hyphen.

Here's a common regexp, defining the characters permitted in a VALID host/domain token:

[-_0-9a-z]

I've _never_ had a problem with this. That isn't interpreted as "from null to underscore, then 0-9, a-z". It is hyphen, underscore, 0-9, a-z.

In any event, the hyphens you're looking for in your condition regexp are outside of the brackets, and thus are not part of a character class declaration, but rather a literal hyphen.

I appears to me that procmail is interpreting the hyphen as part of a
class, ie "include 7 (numberletters) through 6 (numberletters)" or
something similar.

No.

PS: What gets caught in the sandbox (run against ~45Mb of backup messages
and using the $F version) is:

Message-Id: <E1BO2fg-0002He-HQ(_at_)ocjnet(_dot_)com>

this is matched

Message-ID: <3420719457715040(_dot_)0VHV202436i(_at_)takas(_dot_)lt>

this would not

Message-ID: <000101c43a35$37caa07c$e43e752b(_at_)concentric(_dot_)com>

this also would not

Message-ID: <4561374956674185(_dot_)9JH3372138182qfz(_at_)topmail(_dot_)de>

again, no match

Message-Id: 
<PM(_dot_)6720(_dot_)0464916981(_at_)pmweb5(_dot_)uk1(_dot_)bibliotech(_dot_)net>

no match.

PPS: Logfile is no help:

Uh, I don't get your complaint about the logfile - there's stuff in there and it shows what procmail is doing, or there's a config/permissions problem.

---
 Sean B. Straw / Professional Software Engineering

 Procmail disclaimer: <http://www.professional.org/procmail/disclaimer.html>
 Please DO NOT carbon me on list replies.  I'll get my copy from the list.


_______________________________________________
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>