procmail
[Top] [All Lists]

Re: Troubles with $MATCH

2003-12-09 12:59:14
At 13:35 2003-12-09 -0500, Birl wrote:
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; }

Procmail isn't Perl. Heck, Perl isn't egrep either. The parenthetical assignment operator assigns the match to an array of sorts $1, $2, $3. There's NO equivalent in Procmail - You can't match multiple things in a line and assign them to different match variables -- there's no $MATCH1, $MATCH2, etc. So, why expect that the way that the perl regexp processor works has any bearing on Procmail?

How is it that a previous recipe below, which works, never appends an '@'?

:0:
* ^Mailing-List:.*list \/[^(_at_)]+
$MATCH

Well, duh, you're sauing to collect up all the characters that are NOT @. Therefore, once the regexp engine encounters an @, it'll stop - ans since the @ isn't part of the match construct, it won't be included.

So why wouldnt the .* take care multiple addresses?

Greed. It's a matching term. Thing is, you can establish a match on the first portion of your regexp, which can extend into a DIFFERENT address in the second portion because the match regexp you're using doesn't have any exclusionary conditions to prevent that. Go ahead, run your condition in a sandbox and use a To: or Cc: field like I presented and see what your regexp will do.

Not a really a problem for me since Im the only account on Concept.

Setting yourself up with bad regexps is a good way to have something fail on you miserably later when you're trying to do something where this isn't the case, but can't understand why the one recipe seems to work and the other won't, when in fact, they're BOTH broken.

Again, not thinking.  Here's an excerpt:

But at this point, moot, since I already provided you with fixed code.

procmail: Matched " amazon(_at_)concept(_dot_)"
procmail: Match on "^To:.*\/[^(_at_)]+@concept\."

And this tells us what you actually matched on, which is simple to describe. BTW, note that your MATCH includes the leading space before the address, which relates to the following:

procmail: Locking ".email_alias_.lock"
procmail: Skipped "amazon(_at_)concept(_dot_)"

Because an unescaped space appeared in the filename.

---
 Sean B. Straw / Professional Software Engineering

 Procmail disclaimer: <http://www.professional.org/procmail/disclaimer.html>
 Please DO NOT carbon me on list replies.  I'll get my copy from the list.


_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail

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