On 16 March 2000, Martin Mokrejs <mmokrejs(_at_)natur(_dot_)cuni(_dot_)cz>
wrote:
On Thu, 16 Mar 2000, Ralph Seberry wrote:
[...]
:0 H
* ^Subject:[ ]*BOUNCE.*Non-member.*submission.*from.*\[\/[^\]]*
{
ODESILATEL="$MATCH"
LOG="Odesilatel1 je $MATCH
"
}
(instead of ".*", tell it to get all characters up to ']' by using
"[^\]]*")
Hmm, procmail says it matches but the variable is empty.
Don't try to escape the "]" inside [...]:
:0
* ^Subject:[ ]*BOUNCE.*Non-member.*submission.*from.* \[\/[^]]*
{
ODESILATEL="$MATCH"
LOG="Odesilatel1 je $MATCH
"
}
How does the \/ work? Does the match contain everything on the right
side from \/ or everything on the right side from \/ untill "[^\]]*"
is reached?
It contains everything [^]]* matches. Unlike what happens to the
left of \/ the match is also greedy (that is, maximal match).
Could someone please shed a light on these following
recipes? Especially, meaning of plus at the end, the scoring example
reading Delivered-To: field ...
:0 # why do we need $ on the next line, where is variable expansion?
*$ ^Subject:[ ]+\[.*\][ ]+\/.+
| formail -I"Subject: $MATCH"
You don't need the "$".
:0 # here we need $ on the next line to expand $TAG variable, am I right?
* $ ^Subject:(.*\<)?$\TAG\>
{
LEFTSIDE
:0 # pull out Re: or variants
* ^Subject:[ ]*\/R[^ :]+:
{ LEFTSIDE="$MATCH " } # or { LEFTSIDE="Re: " } to make them uniform
:0: # empty match is acceptable
* ^Subject:.*$\TAG[ ]*\/([^ ].*)?
| formail -i"Subject: $LEFTSIDE${MATCH:-empty subject}" >> $FOLDER
}
AFAICT, right.
:0
* ^Delivered-To:[ ]+redirect-\/[^(_at_)]+
! $MATCH(_at_)newdomain(_dot_)com
:0 # what's the difference compared to previous recipe?
* $ 1^1 ^Delivered-To: domain.com.\/[^(_at_)]+
! $MATCH(_at_)newdomain(_dot_)com
(1) They match different things;
(2) The second one is less efficient.
:0
* ^TO_(freebsd-)?\/(security|isdn|ports|questions|current|\
announce|stable|hackers)@freebsd.org
* MATCH ?? ^^\/[^(_at_)]+
$HOME/Mail/$MATCH
No problem here AFAICT.
And finally, to my problem:
# why doesn't he recipe match this string:
["David Silhan" <silhand(_at_)feld(_dot_)cvut(_dot_)cz>] (fwd)
# I want to extract
"David Silhan" <silhand(_at_)feld(_dot_)cvut(_dot_)cz>
* MATCH ?? \[\/[^]].*
The log file shows:
procmail: Skipped "* MATCH ?? \[\/[^]].*"
Sorry, I can't parse this. Where does $MATCH come from?
Regards,
Liviu Daia
--
Dr. Liviu Daia e-mail: Liviu(_dot_)Daia(_at_)imar(_dot_)ro
Institute of Mathematics web page: http://www.imar.ro/~daia
of the Romanian Academy PGP key: http://www.imar.ro/~daia/daia.asc