As it was written on Dec 9, thus Professional Software Engineering typed:
PSE-L: At 10:14 2003-12-09 -0500, Birl wrote:
PSE-L:
PSE-L: >Using data such as procmail(_at_)concept(_dot_)temple(_dot_)edu or
PSE-L: >sbirl+procmail(_at_)concept(_dot_)temple(_dot_)edu and expecting
$MATCH to return
PSE-L: >'procmail'
PSE-L:
PSE-L: FTR, since you explicitly declare something after the match operator
'\/',
PSE-L: that's going to be included in the match. You'll need to weed that
PSE-L: out. One way is to have a second recipe within braces on the first,
PSE-L: another is to have a plain condition check followed by a match (that
leaves
PSE-L: something to be desired), and yet another is to have a second condition
PSE-L: line which makes use of the $MATCH which was set in the first.
Ah. There's part of my problem. I thought that anything after \/ meant
to stop matching when it sees that. Like along the lines of PERL matching:
if ( /sbirl\+(\S+)\(_at_)concept/ ) { print $1; }
How is it that a previous recipe below, which works, never appends an '@'?
:0:
* ^Mailing-List:.*list \/[^(_at_)]+
$MATCH
(similar to
http://www.xray.mpe.mpg.de/mailing-lists/procmail/2003-05/msg00331.html)
I think this too is where I got confused.
PSE-L: ># catch-all for email aliases
PSE-L: >:0
PSE-L: >#* ^(To|Cc):.*\/+(_at_)concept\(_dot_)
PSE-L: >* ^(To|Cc):.*\/[^(_at_)]+@concept\.
PSE-L:
PSE-L: Look for zero or more of anything and then after the match operator,
one or
PSE-L: more of anything that isn't an @, before matching the domain portion.
PSE-L:
PSE-L: This is going to choke on the same multi-recipient addressing that I
PSE-L: mention below. How about you give us some idea of what it is you WANT
in
PSE-L: $MATCH ?
Well I *thought* I mentioned in the original post what I wanted to match:
Birl> Using data such as procmail(_at_)concept(_dot_)temple(_dot_)edu or
Birl> sbirl+procmail(_at_)concept(_dot_)temple(_dot_)edu and expecting
$MATCH to return
Birl> 'procmail'
I jump to and fro between /etc/aliases and just using a +somecrap as an
email address for different sites. So essentially I want to capture the
alias only.
PSE-L: * ^(To|Cc):.*\<\/[^@, ]+(_at_)concept\(_dot_)
PSE-L:
PSE-L: Note inclusion of comma (separator for multiple addresses) space and
PSE-L: tab. Also note addition of the word-break \< before the match
operator, so
PSE-L: if there's multiple addressees, this SHOULD focus on just one of them,
PSE-L: though no doubt there is room for significant improvement.
So why wouldnt the .* take care multiple addresses?
I figured that even if there was more than address to Concept,
TO: sbirl+test1(_at_)concept(_dot_)temple(_dot_)edu,
sbirl+test2(_at_)concept(_dot_)temple(_dot_)edu
that the filter would just drop the email into 'test1' (which is fine by
me).
PSE-L: >:0:
PSE-L: >#* ^(To|Cc):.*sbirl\+\/[^(_at_)]@concept\.
PSE-L: >#* ^(To|Cc):.*sbirl\+\/+(_at_)concept\(_dot_)
PSE-L: >* ^(To|Cc):.*sbirl\+\/[^+]+(_at_)concept\(_dot_)
PSE-L:
PSE-L: Shouldn't have two plusses anyway, but the filter there should
reasonably
PSE-L: catch something - though conceivably, it could be mussed up by:
PSE-L:
PSE-L: Cc: user(_at_)domain(_dot_)tld, sbril+procmail(_at_)concept(_dot_)com,
otheruser(_at_)concept(_dot_)com
Not a really a problem for me since Im the only account on Concept.
PSE-L: # second condition uses the $MATCH set in the first and cleans it up.
Note
PSE-L: # use of + there instead of *.
PSE-L: :0
PSE-L: * ^(To|Cc):.*\<sbirl\+\/[^+@ ]+(_at_)concept\(_dot_)
PSE-L: * $MATCH ?? ()\/[^(_at_)]+
PSE-L: {
PSE-L: LOG="we matched $MATCH${NL}"
PSE-L: }
PSE-L:
PSE-L:
PSE-L: >Problem is simple, $MATCH turns up empty.
PSE-L:
PSE-L: Immediate problem is that you're showing us procmail recipes, and you're
PSE-L: showing that you're doing VERBOSE logging, but you don't provide any
PSE-L: matching excerpts from the log, or an example of the To: and Cc: headers
PSE-L: you're sending at the script.
Again, not thinking. Here's an excerpt:
----------------------------------------------------------------------------------------------
RETURN-PATH ---> <sbirl(_at_)yahoo(_dot_)com>
FROM ---> L L <sbirl(_at_)yahoo(_dot_)com>
TO ---> amazon(_at_)concept(_dot_)ocis(_dot_)temple(_dot_)edu
SUBJECT ---> Test message from sbirl(_at_)yahoo
BEGIN universal deleting recipes
END universal deleting recipes
BEGIN searching for email aliases
END searching for email aliases
procmail: Assigning "LOGABSTRACT=ALL"
procmail: Assigning "MATCH="
procmail: Matched " amazon(_at_)concept(_dot_)"
procmail: Match on "^To:.*\/[^(_at_)]+@concept\."
procmail: Assigning "LOG= Reached catch-all for email aliases
"
Reached catch-all for email aliases
procmail: Locking ".email_alias_.lock"
procmail: Skipped "amazon(_at_)concept(_dot_)"
procmail: Assigning "LASTFOLDER=.email_alias_"
procmail: Opening ".email_alias_"
procmail: Acquiring kernel-lock
procmail: Unlocking ".email_alias_.lock"
From sbirl(_at_)yahoo(_dot_)com Mon Dec 8 15:26:30 2003
Subject: Test message from sbirl(_at_)yahoo
Folder: .email_alias_ 829
----------------------------------------------------------------------------------------------
Thanks
Birl
Archives http://www.xray.mpe.mpg.de/mailing-lists/procmail/
_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail