procmail
[Top] [All Lists]

Re: Removing new lines in MATCH

2000-04-05 23:55:04
Rik Kabel on  wrote...
| * Anthony Thyssen <anthony(_at_)cit(_dot_)gu(_dot_)edu(_dot_)au> [000330 
23:11]:
| 
| What is wrong, for your proposed use, with either \> or \<, both of
| which include non-word characters and newlines?
| 
| > :0 Bfh
| > * $ $OR^0 ()\/this${X}is${X}just${X}a${X}test${X}match
| > * $ $OR^0 ()\/kill${X}me${X}please
| > * $ $OR^0 ()\/I${X}am${X}only${X}kidding
| > | formail -i "X-Junk-Match: $MATCH" 
| > :0 A
| > | rcvstore +$JUNK
| 
| :0 Bfh
| * ()\/(\
|        this\>+is\>+just\>+a\>+test\>+match|\
|        kill\>+me\>please|\
|        i\>+am\>+only\>+kidding|\
|       )
| | formail -i "X-Junk-Match: $MATCH"
| :0 A
| | rcvstore +$JUNK
| 
| \>* can be used when words might be run together. \> also matches
| commas, periods, and other punctuation, making these matches much more
| flexible in dealing with the language found in spam.
| 
That is good. I know from the numerous sources that \> is not a boarder
match but an actual character match. You seem to suggest that \> and \<
are also actually exactly equivelent.

I don't like the use of \| for the large scale RE matches though the
use of $OR and scoring seems to simplify things.

| >   1/ The header line will only contain the matched string up
| >      until the first new line.
| >   2/ Also Formail seems to lowercase all but the first letter (the X)
| >      I can live with this but it is annoying.
| > 

You can ignore the 2rd item above. It seems to be an artifact of the MH
mail system and not procmail or formail.

| To join an arbitrary number of lines in procmail requires either an
| external program (tr, sed, perl...) or a recursive rc. Here is a
| recursive rc which does it.
|
| ...
|
Now that is getting complicated, but it you need to save some forks and
running a shell I suppose I would go for it. but as this is not for a
large, heavy volume procmailrc, I think I'll give it a miss for now.

But wouldn't a better name for it be `joiner' as it joins multiple
lines into one line?

Thanks for the help.

  Anthony Thyssen ( System Programmer )    http://www.sct.gu.edu.au/~anthony/
- --------------------------------------------------------------------------- -
  for a in past present future; do
    for b in clients employers associates relatives neighbours pets; do
      echo The opinions in this article in no way reflect the opinions of $a $b
  done;done
- --------------------------------------------------------------------------- -
     PGP Public Key available -- finger -l 
anthony(_at_)lyrch(_dot_)cit(_dot_)gu(_dot_)edu(_dot_)au  

<Prev in Thread] Current Thread [Next in Thread>