procmail
[Top] [All Lists]

Re: how to match against first N lines/bytes of body?

1997-11-14 08:47:48
Adam Grove asked,

|  > [But] I really wanted to match the truncated body against various
|  > scoring recipes rather than true/false tests. Is there a way of
|  > doing this?

Era Eriksson answered,

| Sure you can. 
| 
| :0
| * $ 1^1 toplines ?? pattern
| * $ 1^1 toplines ?? pattern2
|  :
| etc

Took the words right out of my mouth.

| If you actually go ahead and implement a recipe generator, that would
| remove the obstacles involved with using recipes such as
| 
| :0
| *  ^^\/.(.)?(.)?(.)?(.)?(.)? [... etc ...] (.)?$\
|     (.)?(.)?(.)?(.)?(.)?(.)? [... etc ...] (.)?$?\
|     (.)?(.)?(.)?(.)?(.)?(.)? [... etc ...] (.)?$?\
|   :
| 
| Of course, anything like this is going to hit LINEBUF long before the
| message you are actually trying to look at :-)

It will hit LINEBUF a lot later if you take out all those parentheses.
"(.)?" and ".?" are equivalent.