procmail
[Top] [All Lists]

Re: Isolating the hyphen

2004-05-16 10:52:04
On Sun, May 16, 2004 at 01:03:09PM -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]

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

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

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.

That direction has to do with classes inside square brackets, e.g.,
"[A-Z-]", which would be A through Z and a hyphen.  To match a hyphen
in procmail generally, you just use a hyphen.  There's nothing magical
about the char used outside a [char class].

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, I really don't think it's doing that.

I tried something in my test harness to what you have:


 A=[a-zA-Z0-9]

 :0
 * $ ^Message-ID:[      ]*<\/$A*-$A*[^>]*
 { HYPHEN = "$MATCH" }

And ran it on some spam I have sitting around:

 7:38pm [~/Mail] 730[0]> harness myspam | grep HYPHEN
procmail: Assigning "HYPHEN=e5ms75u-1601-3yas--j701$156vo(_at_)o62m3t6d3pfc"
procmail: Assigning "HYPHEN=k6miwtc7k2m34b49-7t-nf2f(_at_)hda7eu"
procmail: Assigning "HYPHEN=E1Aw3Hp-0002db-SK(_at_)cp(_dot_)yier(_dot_)biz"
procmail: Assigning "HYPHEN=1084691883-11501(_at_)excite(_dot_)com"
procmail: Assigning "HYPHEN=UDJTXQO-0004815970506(_at_)sinai"
procmail: Assigning "HYPHEN=E1BPNPI-0002rC-UC(_at_)m1(_dot_)dnsix(_dot_)com"
procmail: Assigning "HYPHEN=E1BPKPq-0000IO-AF(_at_)m1(_dot_)dnsix(_dot_)com"
procmail: Assigning "HYPHEN=oc10x33v-6q-d(_at_)ymlip"
procmail: Assigning "HYPHEN=KSRQKFK-0004717107815(_at_)convoke"
procmail: Assigning "HYPHEN=w1sh---phe-3vt(_at_)8rd(_dot_)yyhtiz6"
procmail: Assigning "HYPHEN=E1BPEt9-0001gV-UX(_at_)m1(_dot_)dnsix(_dot_)com"
procmail: Assigning "HYPHEN=E1BPHil-0006GN-Le(_at_)m1(_dot_)dnsix(_dot_)com"
procmail: Assigning "HYPHEN=1tw0-x9c95-$-e(_at_)bm4a6ur5o"
procmail: Assigning "HYPHEN=E1BPGvO-0006KB-A3(_at_)m1(_dot_)dnsix(_dot_)com"

So off-hand, I'd say something is eluding you, but not what
you think it to be.  :-)

-- 
dman

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