procmail
[Top] [All Lists]

Re: debugging \<(xxx|yyy|zzz)\>

2004-05-29 07:04:30
Jim had written,

If you didn't find a solution, I'm sure not likely to! :)

Whether there's a solution depends on what the question is. If all you want to do is count the total appearances of all trigger words, there is one:

* 1^1 SPAMSCORE ?? ()\<wild\>
* 1^1 SPAMSCORE ?? ()\<teens?\>
* 1^1 SPAMSCORE  ?? ()\<semprini\>

but if the question is how to do it in a single condition so as to need to scan the variable only once, there's no solution I know that won't get tripped up when two trigger words are separated by only one space or punctuation mark. Well, you could do this,

SPAMSCORE=`echo $SPAMSCORE | sed 's/[^a-zA-Z0-9]/&&/g'`

and then use

* 1^1 SPAMSCORE ?? ()\<(wild|teens?|semprini)\>

but it calls a shell and sed, so it's probably less inefficient than the extra scans. If you were searching the entire body rather than one variable, though, the shell and sed would probably be the better way to go.

Dallman commented,

You want, I think, "wild" plus one or more whitespace OR
newline OR whitespace+newline, plus "teen"; with the two
words bounded by procmail word delimiters.  Right?

No, Jim wants to count the total appearances of delineated spammish words in the text.

P.S.  You're not the Jim Osborn I knew in Heidelberg in the late-
middle ninetees, right?

He's not the Jim Osborn I knew in Chicago in the early-middle 1980s.


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