procmail
[Top] [All Lists]

Re: Striping First Word from Subject Line(Again)

1997-01-29 00:47:29
[Mailed and mailed.]

On Tue, 28 Jan 1997 23:13:09 -0500 (EST), Ryan Bradford Neily
<rbn(_at_)gsu(_dot_)cs(_dot_)GaSoU(_dot_)EDU> wrote:
I am having a terrible time getting this to work.

This is another one for the FAQ.
  The rules involving matching around \/ are pretty intricate. Read
the relevant part of the manual, twice. If you think ".*" is an arcane
regular expression, get someone to help you out.

[JEEP-L:341278] Sample Text Subject Line
 :0
 * ^Subject: *JEEP-L\>.*\/.*
 | formail -I"Subject: $MATCH"

 INBOX.JEEP-L

How do you suppose Procmail will be able to guess which of your .*
should match up to the closing bracket? You have to tell it.

    :0fh
    * ^Subject: \[JEEP-L:[0-9]*\] +\/.*$
    | formail -I"Subject: $MATCH"
    :0A:
    INBOX.JEEP-L

Also, How do I get it to correctly get the message to go into the
INBOX.JEEP-L mailbox?  (Currently it doesnt do that either)

If you have a log, it will tell you it has been ignoring
"INBOX.JEEP-L". You need to have a leading :0 (or some other number,
if you know what you're doing) to make it into a valid recipe. (The A
tells Procmail to execute this recipe if the previous recipe matched.
Figuring out the other flags is left as an exercise :-)
  If you don't keep a log, try turning it on (with VERBOSE=yes) and
see how it magically tells you what's happening. Good for debugging.

Hope this helps,

/* era */

The present recipe will actually only eat the first space after the
closing bracket. So the + before the \/ is pretty redundant. I left it
in as a reminder that this ought to be fixed ... If you never receive
messages with blank Subjects on this list, of if you prefer for those
to have the [JEEP-L] thing retained, you can safely add a [^ ] after
the \/ to fix this (and maybe change the + into a *).

-- 
See <http://www.ling.helsinki.fi/~reriksso/> for mantra, disclaimer, etc.
* If you enjoy getting spam, I'd appreciate it if you'd register yourself
  at the following URL:  <http://www.ling.helsinki.fi/~reriksso/spam.html>