procmail
[Top] [All Lists]

Re: $MATCHing on the left

1999-09-03 20:44:37
At 03:14 PM 9/3/99 -0700, Vince LaMonica wrote:

[snip perl script--yuk]

The problem is that I originally wanted the part that I'm $MATCHing to be
the first part of the subject. Eg: w2000 Same Text Here Always. I only
want to match the 5 character string to use as the name of the gzip file
and the lockfile. I was unable to stop the $MATCH though [it would match
the entire subject]. 

I'm not entirely clear here on exactly what you want... the first
"word" or the first five characters.  I'll do it for the case
where you want the first "word" and the rest are known.  Hopefully
you'll then see how to apply it to the other case if needed:


# This gets the first "word" into $MATCH where you know the rest
# of the words:
:0
* ...your other conditions...
* ^Subject:[    ]*[^    ]+[     ]+Same Text Here Always
* ^Subject:[    ]*\/[^  ]+
put_your_action_here

(There's a space and a tab inside each [ ] and [^ ] pair.)
The first condition looks for Subject:, zero or more blanks,
one or more non-blanks, one or more blanks, then your "fixed"
text.  The second will then perforce match, but set $MATCH only
to the "one or more non-blanks" part of what satisfied the
first condition ("w2000" in your example).

(I have not been paranoid here about mail with multiple
"Subject:" lines; that is possible if you're worried about it,
but it would probably just obfuscate this example to do so.)

<using v3.10pre4 fyi>

You really should upgrade.

Any ideas are greatly appreciated...

Hope that helps,
Stan

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